ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 2002. Тестовое задание

WA7
Послано AtiKun 27 ноя 2016 18:06
ll n, k, op, a[11][11], ans;
string s;
vector < pair < string, string > > alr;
vector < pair < string, string > > lg;
vector < string > out;
int main(){
    cin >> n;
    for(ll i = 1; i <= n; i++){
        cin >> s;
        k = 0;
        if(s == "register"){
            string lo, pa;
            cin >> lo >> pa;
            for(ll i = 0; i < lg.size(); i++){
                if(lo == lg[i].first){
                    cout << "fail: user already exists" << "\n";
                    k = 3;
                    break;
                }
            }
            if(k != 3){
                lg.pb(mp(lo, pa));
                cout << "success: new user added" << "\n";
            }
        }
        k = 0;
        if(s == "login"){
            string acc, par;
            cin >> acc >> par;
            for(ll i = 0; i < alr.size(); i++){
                if(acc == alr[i].first){
                    if(par == alr[i].second){
                        cout << "fail: already logged in";
                        k = 2;
                        break;
                    }
                }
            }
            for(ll i = 0; i < lg.size(); i++){
                if(acc == lg[i].first && k != 2){
                    ans++;
                    if(par == lg[i].second){
                        cout << "success: user logged in";
                        alr.pb(mp(acc, par));
                        out.pb(acc);
                        k = 1;
                        break;
                    }
                }
            }
            if(!k && ans == 0)
                cout << "fail: no such user";
            if(!k && ans > 0)
                cout << "fail: incorrect password";
            cout << "\n";
        }
        ans = 0;
        k = 0;
        if(s == "logout"){
            string avt;
            ll o;
            cin >> avt;
            for(ll i = 0; i < out.size(); i++){
                if(avt == out[i]){
                    out[i] = "````````21";
                    k = 4;
                    break;
                }
            }
            op = 0;
            for(ll i = 0; i < lg.size(); i++){
                if(avt == lg[i].first){
                    op = 1;
                    break;
                }

            }
            if(k != 4 && op){
                cout << "fail: already logged out";
            }
            else
                if(op)
                cout << "success: user logged out";
            if(!op)
                cout << "fail: no such user";
            cout << "\n";
        }
        op = 0;
        k = 0;
    }
}





what is wrong???