Submission #1014699

#TimeUsernameProblemLanguageResultExecution timeMemory
1014699UnforgettableplComparing Plants (IOI20_plants)C++17
5 / 100
70 ms14928 KiB
#include <bits/stdc++.h> using namespace std; vector<int> limit; vector<int> p; void init(int k, std::vector<int> r) { int n = r.size(); p=r; limit.resize(n); vector<bool> visited(n); function<int(int,int)> dfs = [&](int x,int type){ if(r[x]!=type)return x; if(visited[x])return limit[x]; visited[x] = true; return limit[x] = dfs((x+1)%n,type); }; for(int i=0;i<n;i++)dfs(i,r[i]); } int compare_plants(int x, int y) { if(x>y)return -compare_plants(y,x); if(limit[x]<x or y<=limit[x]){ if(p[x])return -1; else return 1; } if(x<=limit[y] and limit[y]<y){ if(p[y])return 1; else return -1; } return 0; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...