# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
815738 | 2023-08-08T20:20:55 Z | denniskim | Handcrafted Gift (IOI20_gift) | C++17 | 165 ms | 19380 KB |
#include "gift.h" #include <bits/stdc++.h> using namespace std; typedef int ll; typedef __int128 lll; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<ld, ld> pld; #define MAX 9223372036854775807LL #define MIN -9223372036854775807LL #define INF 0x3f3f3f3f3f3f3f3f #define fi first #define se second #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout.precision(10); #define sp << " " #define en << "\n" #define compress(v) sort(v.begin(), v.end()), v.erase(unique(v.begin(), v.end()), v.end()) ll arr[5000010]; ll num[5000010]; string ans; vector<pll> vec; int construct(int n, int r, vector<int> a, vector<int> b, vector<int> x) { for(ll i = 0 ; i < n ; i++) { if(x[i] == 1) vec.push_back({a[i], b[i]}); } ll cc = 1, cc2 = 1; ll gapa = 0; if(!vec.empty()) { sort(vec.begin(), vec.end()); ll S = vec[0].fi; ll E = vec[0].se; for(auto &i : vec) { if(!gapa) { gapa = 1; continue; } if(E < i.fi) { for(ll j = S ; j <= E ; j++) arr[j] = cc; cc++; S = i.fi, E = i.se; } else E = max(E, i.se); } for(ll j = S ; j <= E ; j++) arr[j] = cc; cc++; } for(ll i = 0 ; i < n ; i++) { if(!arr[i]) arr[i] = cc++; } /* for(ll i = 0 ; i < n ; i++) { if(!num[arr[i]]) num[arr[i]] = cc2++; } for(ll i = 0 ; i < n ; i++) { if(x[i] == 2) { if(num[arr[b[i]]] - num[arr[a[i]]] == 0) return 0; } }*/ char now = 'R'; ans.push_back('R'); for(ll i = 1 ; i < n ; i++) { if(arr[i] != arr[i - 1]) now = 'B' + 'R' - now; ans.push_back(now); } craft(ans); return 1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 4 ms | 724 KB | Output is correct |
5 | Correct | 154 ms | 19304 KB | Output is correct |
6 | Correct | 153 ms | 19380 KB | Output is correct |
7 | Correct | 165 ms | 19308 KB | Output is correct |
8 | Correct | 145 ms | 19336 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 2 ms | 596 KB | Output is correct |
4 | Correct | 102 ms | 15064 KB | Output is correct |
5 | Correct | 100 ms | 15080 KB | Output is correct |
6 | Incorrect | 101 ms | 15068 KB | Possible does not match answer file |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 240 KB | Output is correct |
7 | Incorrect | 0 ms | 212 KB | Possible does not match answer file |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Requirement 2 not satisfied |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 4 ms | 724 KB | Output is correct |
5 | Correct | 154 ms | 19304 KB | Output is correct |
6 | Correct | 153 ms | 19380 KB | Output is correct |
7 | Correct | 165 ms | 19308 KB | Output is correct |
8 | Correct | 145 ms | 19336 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 2 ms | 596 KB | Output is correct |
12 | Correct | 102 ms | 15064 KB | Output is correct |
13 | Correct | 100 ms | 15080 KB | Output is correct |
14 | Incorrect | 101 ms | 15068 KB | Possible does not match answer file |
15 | Halted | 0 ms | 0 KB | - |