Submission #450396

#TimeUsernameProblemLanguageResultExecution timeMemory
450396MohamedAliSaidaneCave (IOI13_cave)C++14
0 / 100
1 ms332 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; #define pb push_back #define popb pop_back #define ff first #define ss second const int MOD = 1e9 + 7; const int MAX_N = 5004; bool visited[MAX_N]; void exploreCave(int n) { int comb[n]; memset(comb,0,sizeof(comb)); int first = tryCombination(comb); int ass[n]; memset(ass,0,sizeof(ass)); int state[n]; memset(state,0,sizeof(state)); int cnt = 0; while(cnt < n) { for(int i = 0; i < n ; i ++) { if(visited[i]) continue; comb[i] = 1 - comb[i]; int ess = tryCombination(comb); if(ess != -1 && ess < first) { comb[i] = 1 - comb[i]; ass[i] = ess; state[i] = comb[i]; visited[i] = true; cnt ++; } else if(ess > first || ess == -1) { ass[i] = first; state[i] = comb[i]; visited[i] = true; cnt ++; if(cnt == n) break; else { for(int j = 0; j <n; j ++) { if(visited[j]) continue; else { comb[j] = 1 - comb[j]; ass[j] = tryCombination(comb); comb[j] = 1 - comb[j]; state[j] = comb[j]; visited[j] = true; cnt ++; } } } } } } answer(state,ass); return ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...