Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Web Browser History
#include<stdio.h> #include<iostream> #include<bits/stdc++.h> using namespace std; #define INIT 0 #define VISIT 1 #define DELETE 2 #define ACCESS 3 #define LAST5 4 #define RED "\033[1m\033[31m" #define GREEN "\033[1m\033[32m" #define WHITE "\033[1m\033[37m" extern void init(); extern void visit(string link); extern void deleteLink(string link); extern void access(string link); extern vector<string> last5(); int main() { cout << WHITE; freopen("test50.txt", "r", stdin); int T; scanf("%d", &T); cout << "TEST-CASES : " << T << "\n"; clock_t start, end; start = clock(); bool flag = true; string word; for(int test_case = 1; test_case <= T ;test_case++) { int N; scanf("%d",&N); //cout << "N : " << N << "\n"; bool localFlag = true; init(); for(int i=0;i<N;i++) { int op; scanf("%d",&op); if(op == VISIT) { cin >> word; //cout << "VISIT - " << word << "\n"; visit(word); } else if(op == DELETE) { cin >> word; //cout << "DELETE - " << word << "\n"; deleteLink(word); } else if(op == ACCESS) { cin >> word; //cout << "ACCESS - " << word << "\n"; access(word); } else if(op == LAST5) { int count; cin >> count; vector<string> ans; string x; for(int j=0;j<count;j++) { cin >> x; ans.push_back(x); } vector<string> userAns = last5(); // cout << "AC : "; // for(int j=0;j<ans.size();j++) // cout << ans[j] << " "; // cout << "\n"; // cout << "MY : "; // for(int j=0;j<userAns.size();j++) // cout << userAns[j] << " "; // cout << "\n\n"; if(userAns.size() != ans.size()) { localFlag = false; flag = false; } else { for(int j=0;j<count;j++) { if(userAns[j]!=ans[j]) { localFlag = false; flag = false; } } } } } if(localFlag) { cout << GREEN << "#" << test_case << " - 100\n"; } else { cout << RED << "#" << test_case << " - 0\n"; } } end = clock(); cout << "\n" << WHITE; if(flag) cout << "SCORE : 100\n"; else cout << "SCORE : 0\n"; double time_taken = double(end - start) / double(CLOCKS_PER_SEC); cout << "RUN_TIME : " << fixed << setprecision(6) << time_taken ; cout << " sec " << endl; if(time_taken > 3) cout << RED << "VERDICT : TIME_LIMIT_EXCEEDED\n"; else if(flag == false) cout << RED << "VERDIT : WRONG_ANSWER\n"; else cout << GREEN << "VERDICT : AC\n"; }
run
|
edit
|
history
|
help
0
Bimap operations
on_off
work
queueArray
Making pyramid using nested loop 2/2
Microsoft - MaxEmployeeAttendence (R repititions - Semi Optimised DP)
Dar
designated-inits
articulation points and bridges
Pairs having sum equal to target