/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 3ms 332.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
const int N = 1e5;
const int Prime = 1e9+7;
const int Base = 251;


//...................................................................//
#define endl                '\n'
#define Int                 long long int
#define gcd(x, y)           (__gcd(x, y))
#define lcm(x, y)           ((x/gcd(x, y))*y)
#define rand(x, y)          rand()%(y-x+1)+x
#define pow2(x)             (1<<x)
#define pi                  3.141592653589793
#define decimal(x, y)       fixed<<setprecision(x)<<y
#define unsync              ios_base::sync_with_stdio(0); cin.tie(0);
#define TxtI                freopen("input.txt","r",stdin);
#define TxtO                freopen("output.txt","w",stdout);
//...................................................................//


int main()
{
    //srand(time(0));
    //TxtI TxtO
    unsync

    int t;
    
    cin >> t;
    
    while(t--)
    {
        string s, sc="[!@#$%^&*()].";
        map<char, int> mp;
        bool valid1=false, valid2=false, valid3=false, valid4=false;

        cin >> s;

        for(int i=0; i<s.size(); i++)
            mp[s[i]]++;

        for(char i : sc)
        {
            if(mp[i])
            {
                valid1 = true;
                break;
            }
        }

        for(int i=0; i<s.size(); i++)
        {
            if(s[i]>='A' && s[i]<='Z')
            {
                valid2 = true;
                break;
            }
        }

        for(int i=0; i<s.size(); i++)
        {
            if(s[i]>='a' && s[i]<='z')
            {
                valid3 = true;
                break;
            }
        }

        for(int i=0; i<s.size(); i++)
        {
            if(s[i]>='0' && s[i]<='9')
            {
                valid4 = true;
                break;
            }
        }

        if(valid1 && valid2 && valid3 && valid4 && s.size()>=8)
            cout << "valid" << endl;
        else
            cout << "invalid" << endl;
    }
}

Information

Submit By
Type
Submission
Problem
P1007 Password Checker
Contest
Beta Round #1
Language
C++17 (G++ 13.2.0)
Submit At
2023-11-29 17:55:18
Judged At
2024-11-11 03:50:21
Judged By
Score
100
Total Time
3ms
Peak Memory
332.0 KiB