Submission #697274

#TimeUsernameProblemLanguageResultExecution timeMemory
697274youngyojunHandcrafted Gift (IOI20_gift)C++17
25 / 100
2 ms428 KiB
#include "gift.h" #include <bits/stdc++.h> using namespace std; int construct(int N, int K, vector<int> A, vector<int> B, vector<int> C) { vector<int> D(N); for(int i = K; i--;) if(1 == C[i] && A[i] != B[i]) { D[A[i]]++; D[B[i]]--; } for(int i = 1; i < N; i++) D[i] += D[i-1]; vector<int> E(N); for(int i = 1, c = 0; i < N; i++) { if(!D[i-1]) c ^= 1; E[i] = c; } for(int i = N; i; i--) D[i] = 0; for(int i = 1; i < N; i++) D[i-1] = E[i-1] ^ E[i]; for(int i = 1; i < N; i++) D[i] += D[i-1]; for(int i = K; i--;) if(2 == C[i] && (A[i] == B[i] || D[B[i]-1] == (A[i] ? D[A[i]-1] : 0))) return 0; string ret; for(int i = 0; i < N; i++) ret += E[i] ? 'R' : 'B'; craft(ret); 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...