Submission #747279

#TimeUsernameProblemLanguageResultExecution timeMemory
747279LIFHandcrafted Gift (IOI20_gift)C++14
0 / 100
1 ms216 KiB
#include "gift.h" #include<bits/stdc++.h> #include<string> using namespace std; int cnt[500005]; int red[500005]; int su[500005]; int construct(int n, int r, std::vector<int> a, std::vector<int> b, std::vector<int> x) { for(int i=0;i<r;i++) { if(x[i] == 2)continue; cnt[a[i]]+=1; cnt[b[i]+1] += -1; } int les = 0; for(int i=0;i<n;i++) { les += cnt[i]; if(les >= 1)red[i] = 1; } su[0] = red[0]; for(int i=1;i<n;i++)su[i] = su[i-1] + red[i]; for(int i=0;i<r;i++) { if(x[i] == 1)continue; int xx = su[b[i]] - su[max(a[i]-1,0)]; if(xx == b[i]-a[i]+1)return 0; } string s; for(int i=0;i<n;i++) { if(red[i] == 1)s += "R"; else s += "B"; } return 1; }
#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...