Submission #594605

#TimeUsernameProblemLanguageResultExecution timeMemory
594605OzyMars (APIO22_mars)C++17
0 / 100
1 ms388 KiB
#include "mars.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for (int i = (a); i <= (b); i++) #define repa(i,a,b) for (int i = (a); i >= (b); i--) #define lli long long int #define inicio "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" vector <std::vector<std::string>> A; std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n) { swap(A,a); string st = inicio; lli pos,largo; largo = 2*n + 1; if (k == 0) { rep(x,0,2) { rep(y,0,2) { pos = (x+i)*largo + (j+y) + 1; A[x][y][pos] = A[x][y][0]; } } } rep(x,0,2) { rep(y,0,2) { rep(q,0,99) if (A[x][y][q] == '1') st[q] = '1'; } } if (k < n-1) return st; lli act,nue,res = 0; queue<lli> cola; lli visitados[200]; rep(q,1,n) visitados[q] = 0; rep(i,1,99) { if (visitados[i] == 1) continue; if (st[i] == '1') { res++; cola.push(i); while (!cola.empty()) { act = cola.front(); cola.pop(); if (visitados[act] == 1) continue; visitados[act] = 1; nue = act+1; if (act%largo != 0) if (st[nue] == '1') cola.push(nue); nue = act-1; if (nue%largo != 0) if (st[nue] == '1')cola.push(nue); nue = act+largo; if (nue <= (largo*largo)) if (st[nue] == '1') cola.push(nue); nue = act-largo; if (nue > 0) if (st[nue] == '1') cola.push(nue); } } } string fin = inicio; lli cont = 0; while (res > 0) { if (res&1) fin[cont] = '1'; res /= 2; cont++; } return fin; }
#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...
#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...