제출 #957123

#제출 시각아이디문제언어결과실행 시간메모리
957123DeltaStructHandcrafted Gift (IOI20_gift)C++17
100 / 100
170 ms28720 KiB
#include "gift.h" #include <bits/stdc++.h> using namespace std; int construct(int n,int m,vector<int> A,vector<int> B,vector<int> C){ vector<int> D(n); iota(D.begin(),D.end(),0); for (int i(0);i < m;++i) if (C[i]==1) D[A[i]] = max(D[A[i]],B[i]); set<int> s; string r,u="RB"; int t=0; for (int i(0);i < n;++i){ s.emplace(D[i]),r+=u[t]; if (s.find(i)!=s.end()) s.erase(i); if (s.empty()) t^=1; } vector<int> acc(1); int cant = 0; for (char a:r) acc.emplace_back(acc.back()+(a=='B')); for (int i(0);i < m;++i) if (C[i]==2) if (acc[B[i]+1]-acc[A[i]]==0||acc[B[i]+1]-acc[A[i]]==B[i]-A[i]+1) cant = 1; if (cant) return 0; craft(r); 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...