ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 2002. Test Task

C++ AC for lazy guys with 3 vectors
Posted by D4nick 2 Jan 2019 07:24
#include <iostream>
#include <string>
#include <vector>
#include <iterator>
using namespace std;
int main() {
int n;
cin >> n;

for (int i = 0; i < n; i++) {
cin >> command;
if (command == "register") {
if (find(names.begin(), names.end(), username) == names.end()) {
cout << "success: new user added" << '\n';
}
else
cout << "fail: user already exists" << '\n';
}
auto f = find(names.begin(), names.end(), username);
if (f == names.end())
cout << "fail: no such user" << '\n';
cout << "fail: incorrect password" << '\n';
else if (IsLogin[f - names.begin()] == 1)
cout << "fail: already logged in" << '\n';
else {
cout << "success: user logged in" << '\n';
}
}
if (command == "logout") {