# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
982813 |
2024-05-14T18:32:08 Z |
vjudge1 |
Mars (APIO22_mars) |
C++17 |
|
9 ms |
4448 KB |
#include <bits/stdc++.h>
#define endl '\n'
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define fo(i,n) for(auto i =0 ; i < n;i++)
#define fore(i,l,r) for(auto i = l; i < r;i++)
#define forex(i,r,l) for(auto i = r; i >= l; i--)
#define ffo(i,n) forex(i,n-1,0)
#define all(x) x.begin(),x.end()
#define lsb(x) x&(-x)
#define sz(x) (int)x.size()
#define gcd(a,b) __gcd(a,b)
#define vii vector<ii>
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<ll>;using ii = pair<ll,ll>;using mii = map<ll,ll>;
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
string process(vector<vector<string>> a,int x,int y,int ph,int n){
string res="";
fo(i,100)res+='0';
if(n>6)return res;
// if(ph == 0){
// fo(i, 3)
// fo(j, 3)
// res[(i*3) + j] = a[i][j][0];
// return res;
// }else{
if(ph == n-1){
// aqui no importa el tamaño entonces el que yo le de
// limites de 6
fo(i,1000)res+='0';
}
int con = (ph +1 ) *2 + 1, con2 = con-2;
// cout<<con<<" "<<con2<<endl;
fo(i,con2){
fo(j, con2)
res[(i*con) + j] = a[0][0][(i*con2) + j];
res[(i*con) + con-2] = a[0][1][(i*con2) + con2 - 1];
res[(i*con) + con-1] = a[0][2][(i*con2) + con2 - 1];
}
// cout<<res<<endl;
fo(i,con2)
res[((con-2)*con) +i] = a[1][0][((con2-1)*con2) + i];
res[((con-2)*con) + con-2] = a[1][1][con2*con2 - 1];
res[((con-2)*con) + con-1] = a[1][2][con2*con2 - 1];
fo(i,con2)
res[((con-1)*con) + i] = a[2][0][((con2-1)*con2) + i];
res[((con-1)*con) + con-2] = a[2][1][con2*con2 - 1];
res[((con-1)*con) + con-1] = a[2][2][con2*con2 - 1];
// cout<<res<<endl;
if(ph == n-1){
int tot = 0;
vector<vi> vis(2*n+1, vi(2*n+1, 0));
fo(i,2*n+1){
fo(j,2*n+1){
if(vis[i][j])continue;
if(res[(i*con) + j] == '0') continue;
queue<ii> q;q.push({i,j});tot++;
vi dir = {0,-1,0,1,0};
while(!q.empty()){
auto where = q.front();q.pop();
fo(k,4){
int sr = where.f + dir[k], sc = where.s + dir[k+1];
if(sr<0 || sc<0 || sr>2*n || sc>2*n)continue;
if(vis[sr][sc])continue;
if(res[(sr*con) + sc] == '0')continue;
q.push({sr, sc});vis[sr][sc] = 1;
}
}
}
}
string ans = "";fo(i,100) ans+='0';
for(int bit =0;bit<=30;bit++)if(tot&(1<<bit))ans[bit] = '1';
return ans;
}
return res;
// }
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3904 KB |
Output is correct |
2 |
Correct |
6 ms |
3728 KB |
Output is correct |
3 |
Correct |
4 ms |
4088 KB |
Output is correct |
4 |
Correct |
6 ms |
4432 KB |
Output is correct |
5 |
Correct |
6 ms |
3916 KB |
Output is correct |
6 |
Correct |
4 ms |
3428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3904 KB |
Output is correct |
2 |
Correct |
6 ms |
3728 KB |
Output is correct |
3 |
Correct |
4 ms |
4088 KB |
Output is correct |
4 |
Correct |
6 ms |
4432 KB |
Output is correct |
5 |
Correct |
6 ms |
3916 KB |
Output is correct |
6 |
Correct |
4 ms |
3428 KB |
Output is correct |
7 |
Correct |
8 ms |
3440 KB |
Output is correct |
8 |
Correct |
8 ms |
4448 KB |
Output is correct |
9 |
Correct |
9 ms |
3864 KB |
Output is correct |
10 |
Correct |
9 ms |
3608 KB |
Output is correct |
11 |
Correct |
8 ms |
4112 KB |
Output is correct |
12 |
Correct |
9 ms |
3520 KB |
Output is correct |
13 |
Correct |
8 ms |
3768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3904 KB |
Output is correct |
2 |
Correct |
6 ms |
3728 KB |
Output is correct |
3 |
Correct |
4 ms |
4088 KB |
Output is correct |
4 |
Correct |
6 ms |
4432 KB |
Output is correct |
5 |
Correct |
6 ms |
3916 KB |
Output is correct |
6 |
Correct |
4 ms |
3428 KB |
Output is correct |
7 |
Correct |
8 ms |
3440 KB |
Output is correct |
8 |
Correct |
8 ms |
4448 KB |
Output is correct |
9 |
Correct |
9 ms |
3864 KB |
Output is correct |
10 |
Correct |
9 ms |
3608 KB |
Output is correct |
11 |
Correct |
8 ms |
4112 KB |
Output is correct |
12 |
Correct |
9 ms |
3520 KB |
Output is correct |
13 |
Correct |
8 ms |
3768 KB |
Output is correct |
14 |
Incorrect |
2 ms |
460 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3904 KB |
Output is correct |
2 |
Correct |
6 ms |
3728 KB |
Output is correct |
3 |
Correct |
4 ms |
4088 KB |
Output is correct |
4 |
Correct |
6 ms |
4432 KB |
Output is correct |
5 |
Correct |
6 ms |
3916 KB |
Output is correct |
6 |
Correct |
4 ms |
3428 KB |
Output is correct |
7 |
Correct |
8 ms |
3440 KB |
Output is correct |
8 |
Correct |
8 ms |
4448 KB |
Output is correct |
9 |
Correct |
9 ms |
3864 KB |
Output is correct |
10 |
Correct |
9 ms |
3608 KB |
Output is correct |
11 |
Correct |
8 ms |
4112 KB |
Output is correct |
12 |
Correct |
9 ms |
3520 KB |
Output is correct |
13 |
Correct |
8 ms |
3768 KB |
Output is correct |
14 |
Incorrect |
2 ms |
460 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3904 KB |
Output is correct |
2 |
Correct |
6 ms |
3728 KB |
Output is correct |
3 |
Correct |
4 ms |
4088 KB |
Output is correct |
4 |
Correct |
6 ms |
4432 KB |
Output is correct |
5 |
Correct |
6 ms |
3916 KB |
Output is correct |
6 |
Correct |
4 ms |
3428 KB |
Output is correct |
7 |
Correct |
8 ms |
3440 KB |
Output is correct |
8 |
Correct |
8 ms |
4448 KB |
Output is correct |
9 |
Correct |
9 ms |
3864 KB |
Output is correct |
10 |
Correct |
9 ms |
3608 KB |
Output is correct |
11 |
Correct |
8 ms |
4112 KB |
Output is correct |
12 |
Correct |
9 ms |
3520 KB |
Output is correct |
13 |
Correct |
8 ms |
3768 KB |
Output is correct |
14 |
Incorrect |
2 ms |
460 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3904 KB |
Output is correct |
2 |
Correct |
6 ms |
3728 KB |
Output is correct |
3 |
Correct |
4 ms |
4088 KB |
Output is correct |
4 |
Correct |
6 ms |
4432 KB |
Output is correct |
5 |
Correct |
6 ms |
3916 KB |
Output is correct |
6 |
Correct |
4 ms |
3428 KB |
Output is correct |
7 |
Correct |
8 ms |
3440 KB |
Output is correct |
8 |
Correct |
8 ms |
4448 KB |
Output is correct |
9 |
Correct |
9 ms |
3864 KB |
Output is correct |
10 |
Correct |
9 ms |
3608 KB |
Output is correct |
11 |
Correct |
8 ms |
4112 KB |
Output is correct |
12 |
Correct |
9 ms |
3520 KB |
Output is correct |
13 |
Correct |
8 ms |
3768 KB |
Output is correct |
14 |
Incorrect |
2 ms |
460 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3904 KB |
Output is correct |
2 |
Correct |
6 ms |
3728 KB |
Output is correct |
3 |
Correct |
4 ms |
4088 KB |
Output is correct |
4 |
Correct |
6 ms |
4432 KB |
Output is correct |
5 |
Correct |
6 ms |
3916 KB |
Output is correct |
6 |
Correct |
4 ms |
3428 KB |
Output is correct |
7 |
Correct |
8 ms |
3440 KB |
Output is correct |
8 |
Correct |
8 ms |
4448 KB |
Output is correct |
9 |
Correct |
9 ms |
3864 KB |
Output is correct |
10 |
Correct |
9 ms |
3608 KB |
Output is correct |
11 |
Correct |
8 ms |
4112 KB |
Output is correct |
12 |
Correct |
9 ms |
3520 KB |
Output is correct |
13 |
Correct |
8 ms |
3768 KB |
Output is correct |
14 |
Incorrect |
2 ms |
460 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3904 KB |
Output is correct |
2 |
Correct |
6 ms |
3728 KB |
Output is correct |
3 |
Correct |
4 ms |
4088 KB |
Output is correct |
4 |
Correct |
6 ms |
4432 KB |
Output is correct |
5 |
Correct |
6 ms |
3916 KB |
Output is correct |
6 |
Correct |
4 ms |
3428 KB |
Output is correct |
7 |
Correct |
8 ms |
3440 KB |
Output is correct |
8 |
Correct |
8 ms |
4448 KB |
Output is correct |
9 |
Correct |
9 ms |
3864 KB |
Output is correct |
10 |
Correct |
9 ms |
3608 KB |
Output is correct |
11 |
Correct |
8 ms |
4112 KB |
Output is correct |
12 |
Correct |
9 ms |
3520 KB |
Output is correct |
13 |
Correct |
8 ms |
3768 KB |
Output is correct |
14 |
Incorrect |
2 ms |
460 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3904 KB |
Output is correct |
2 |
Correct |
6 ms |
3728 KB |
Output is correct |
3 |
Correct |
4 ms |
4088 KB |
Output is correct |
4 |
Correct |
6 ms |
4432 KB |
Output is correct |
5 |
Correct |
6 ms |
3916 KB |
Output is correct |
6 |
Correct |
4 ms |
3428 KB |
Output is correct |
7 |
Correct |
8 ms |
3440 KB |
Output is correct |
8 |
Correct |
8 ms |
4448 KB |
Output is correct |
9 |
Correct |
9 ms |
3864 KB |
Output is correct |
10 |
Correct |
9 ms |
3608 KB |
Output is correct |
11 |
Correct |
8 ms |
4112 KB |
Output is correct |
12 |
Correct |
9 ms |
3520 KB |
Output is correct |
13 |
Correct |
8 ms |
3768 KB |
Output is correct |
14 |
Incorrect |
2 ms |
460 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3904 KB |
Output is correct |
2 |
Correct |
6 ms |
3728 KB |
Output is correct |
3 |
Correct |
4 ms |
4088 KB |
Output is correct |
4 |
Correct |
6 ms |
4432 KB |
Output is correct |
5 |
Correct |
6 ms |
3916 KB |
Output is correct |
6 |
Correct |
4 ms |
3428 KB |
Output is correct |
7 |
Correct |
8 ms |
3440 KB |
Output is correct |
8 |
Correct |
8 ms |
4448 KB |
Output is correct |
9 |
Correct |
9 ms |
3864 KB |
Output is correct |
10 |
Correct |
9 ms |
3608 KB |
Output is correct |
11 |
Correct |
8 ms |
4112 KB |
Output is correct |
12 |
Correct |
9 ms |
3520 KB |
Output is correct |
13 |
Correct |
8 ms |
3768 KB |
Output is correct |
14 |
Incorrect |
2 ms |
460 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |