# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
789995 | 2023-07-22T08:47:59 Z | ono_de206 | Prisoner Challenge (IOI22_prison) | C++17 | 11 ms | 1448 KB |
#include "prison.h" #include<bits/stdc++.h> using namespace std; #define in insert #define all(x) x.begin(),x.end() #define pb push_back #define eb emplace_back #define ff first #define ss second //#define int long long typedef long long ll; typedef vector<int> vi; typedef set<int> si; typedef multiset<int> msi; typedef pair<int, int> pii; typedef vector<pii> vpii; vector<vector<int>> devise_strategy(int n) { vector<vector<int>> rep(n + 1, vector<int>(8)); for(int i = 0; i <= n; i++) { int x = i; for(int j = 0; j < 8; j++) { rep[i][j] = x % 3; x /= 3; } } vector<vector<int>> ret{vector<int>{0}}; for(int i = 1; i <= n; i++) { ret[0].pb(rep[i][7] + 1); } int bit = 7, now = 1; vector<int> pl{-1, -2}; // 0 = A 1 = B while(bit > 0) { vector<int> idx{ret.size() + 3, ret.size() + 4, ret.size() + 5}; for(int j = 0; j < 3; j++) { vector<int> tmp{now}; for(int i = 1; i <= n; i++) { if(rep[i][bit] < j) tmp.pb(pl[now]); else if(rep[i][bit] > j) tmp.pb(pl[now ^ 1]); else { if(bit == 1) { if(rep[i][bit - 1] == 0) tmp.pb(pl[now]); else if(rep[i][bit - 1] == 2) tmp.pb(pl[now ^ 1]); else tmp.pb(idx[0]); } else { tmp.pb(idx[rep[i][bit - 1]]); } } } ret.pb(tmp); } bit--; now ^= 1; } vector<int> tmp(n + 1); tmp[0] = now; for(int i = 1; i <= n; i++) { if(rep[i][0] == 0) tmp[i] = pl[now]; else if(rep[i][0] == 2) tmp[i] = pl[now ^ 1]; } ret.pb(tmp); return ret; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 300 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 2 ms | 296 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 2 ms | 340 KB | Output is correct |
9 | Correct | 2 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 304 KB | Output is correct |
9 | Correct | 2 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Partially correct | 1 ms | 212 KB | Output is partially correct |
3 | Partially correct | 0 ms | 300 KB | Output is partially correct |
4 | Partially correct | 4 ms | 724 KB | Output is partially correct |
5 | Partially correct | 8 ms | 1260 KB | Output is partially correct |
6 | Partially correct | 9 ms | 1364 KB | Output is partially correct |
7 | Partially correct | 10 ms | 1448 KB | Output is partially correct |
8 | Partially correct | 1 ms | 212 KB | Output is partially correct |
9 | Partially correct | 1 ms | 340 KB | Output is partially correct |
10 | Partially correct | 2 ms | 340 KB | Output is partially correct |
11 | Partially correct | 4 ms | 724 KB | Output is partially correct |
12 | Partially correct | 11 ms | 1236 KB | Output is partially correct |