Submission #1161663

#TimeUsernameProblemLanguageResultExecution timeMemory
1161663mateuszwesMemory 2 (JOI16_memory2)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h> #include "Memory2_lib.h" using namespace std; #define ll long long #define ull unsigned ll #define pb push_back #define pii pair<int,int> #define pl pair<ll,ll> #define F first #define S second #define pq priority_queue #define all(x) x.begin(), x.end() #define deb(x) cout << #x << " = " << x << '\n'; #define deb2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << '\n'; constexpr int M = 1e9+7; constexpr int N = 107; constexpr bool debug = 0; int decided[107]; //int taken[107]; //to deduce last number? void Solve(int t, int n){ //repeats until only 2 cards //deb(t); int ob = 2; int A = 0, B = 1, C = 2; if(n == 1){ Answer(0,1,0); return; } while(ob < 2*n){ int x = Flip(A,B); int y = Flip(A,C); int z = Flip(B,C); //deb(x); //deb(y); //deb(z); if(x == y){ decided[A] = x+1; //deb2(A,decided[A]); //taken[x+1]++; A = ++ob; } else if(y == z){ decided[C] = y+1; //deb2(C,decided[C]); //taken[y+1]++; C = ++ob; } else{ decided[B] = z+1; //deb2(B,decided[B]); //taken[z+1]++; B = ++ob; } } //deb(A); //deb(B); //deb(C); if(A == ob){ int x = Flip(B,C); decided[B] = decided[C] = x+1; } else if(B == ob){ int x = Flip(A,C); decided[A] = decided[C] = x+1; } else{ int x = Flip(A,B); decided[A] = decided[B] = x+1; } //for(int i = 0; i < 2*n; i++) deb(decided[i]); for(int i = 1; i <= n; i++){ pii ok = {-1,-1}; for(int j = 0; j < 2*n; j++){ if(decided[j] == i){ if(ok.F == -1) ok.F = j; else{ //deb2(ok.F, j); Answer(ok.F,j,i-1); break; } } } } return; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...