Submission #697705

#TimeUsernameProblemLanguageResultExecution timeMemory
697705tvladm2009Handcrafted Gift (IOI20_gift)C++17
0 / 100
1 ms468 KiB
#include <bits/stdc++.h> #include "gift.h" using namespace std; typedef long long ll; const int N_MAX = 500000; int mars[N_MAX + 2], ok[N_MAX + 2]; int construct(int n, int r, vector <int> a, vector <int> b, vector <int> x) { for (int i = 0; i < n; i++) { a[i]++; b[i]++; if (a[i] == b[i] && x[i] == 1) { return 0; } } for (int i = 0; i < r; i++) { if (x[i] == 1) { mars[a[i]]++; mars[b[i] + 1]--; } } for (int i = 1; i <= n; i++) { mars[i] += mars[i - 1]; if (mars[i] != 0) { ok[i] = ok[i - 1] + 1; } } for (int i = 0; i < r; i++) { if (x[i] == 1) { continue; } if (ok[b[i]] - ok[a[i] - 1] == b[i] - a[i] + 1) { return 0; } } string s = "R"; for (int i = 1; i < n; i++) { if (ok[i + 1] <= 1) { if (s[i - 1] == 'R') { s += 'B'; } else { s += 'R'; } } else { s += s[i - 1]; } } craft(s); 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...