Submission #960272

# Submission time Handle Problem Language Result Execution time Memory
960272 2024-04-10T06:18:44 Z Wansur Mars (APIO22_mars) C++17
36 / 100
105 ms 5036 KB
#include <bits/stdc++.h>
#define f first
#define s second
#define ent '\n'
//#define int long long

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")

const int dx[]={-1, 1, 0, 0, 0};
const int dy[]={0, 0, 1, -1, 0};
typedef long long ll;
using namespace std;
const int mx=50+12;
const int mod=998244353;
const bool T=1;

bool used[mx][mx];
int c[mx][mx];

void dfs(int x,int y,int n){
    used[x][y]=1;
    for(int i=0;i<4;i++){
        int x1=dx[i]+x;
        int y1=dy[i]+y;
        if(x1>=0 && y1>=0 && x1<n && y1<n && !used[x1][y1]){
            dfs(x1, y1, n);
        }
    }
}

string gn(int n) {
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            used[i][j] ^= 1;
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (!used[i][j]){
                dfs(i, j, n);
                cnt++;
            }
        }
    }
    string ans="";
    for(int i=0;i<20;i++){
        if((cnt&(1<<i))){
            ans+='1';
        }
        else{
            ans+='0';
        }
    }
    while(ans.size()<100){
        ans+='0';
    }
    return ans;
}

string process(vector<vector<string> > a,int x,int y,int k,int n){
    k++;
    for(int i=x;i<=x+2;i++){
        for(int j=y;j<=y+2;j++){
            int pos=0;
            for(int s=i;s<i+2*k-1;s+=2){
                for(int f=j;f<j+2*k-1;f+=2){
                    used[s][f] = (a[i-x][j-y][pos] == '1');
                    pos++;
                }
            }
        }
    }
    string ans="";
    for(int i=x;i<x+2*k+1;i+=2){
        for(int j=y;j<y+2*k+1;j+=2){
            ans+=char(used[i][j]+'0');
        }
    }
    while(ans.size() < 100){
        ans+='0';
    }
    if(n==k){
        return gn(n * 2 + 1);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 3892 KB Output is correct
2 Correct 6 ms 3864 KB Output is correct
3 Correct 5 ms 3516 KB Output is correct
4 Correct 4 ms 3476 KB Output is correct
5 Correct 7 ms 4052 KB Output is correct
6 Correct 7 ms 4532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 3892 KB Output is correct
2 Correct 6 ms 3864 KB Output is correct
3 Correct 5 ms 3516 KB Output is correct
4 Correct 4 ms 3476 KB Output is correct
5 Correct 7 ms 4052 KB Output is correct
6 Correct 7 ms 4532 KB Output is correct
7 Correct 8 ms 4288 KB Output is correct
8 Correct 8 ms 3896 KB Output is correct
9 Correct 11 ms 3360 KB Output is correct
10 Correct 8 ms 3676 KB Output is correct
11 Correct 8 ms 4068 KB Output is correct
12 Correct 8 ms 4112 KB Output is correct
13 Correct 12 ms 4128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 3892 KB Output is correct
2 Correct 6 ms 3864 KB Output is correct
3 Correct 5 ms 3516 KB Output is correct
4 Correct 4 ms 3476 KB Output is correct
5 Correct 7 ms 4052 KB Output is correct
6 Correct 7 ms 4532 KB Output is correct
7 Correct 8 ms 4288 KB Output is correct
8 Correct 8 ms 3896 KB Output is correct
9 Correct 11 ms 3360 KB Output is correct
10 Correct 8 ms 3676 KB Output is correct
11 Correct 8 ms 4068 KB Output is correct
12 Correct 8 ms 4112 KB Output is correct
13 Correct 12 ms 4128 KB Output is correct
14 Correct 16 ms 3956 KB Output is correct
15 Correct 24 ms 4572 KB Output is correct
16 Correct 24 ms 4280 KB Output is correct
17 Correct 24 ms 4416 KB Output is correct
18 Correct 24 ms 3932 KB Output is correct
19 Correct 23 ms 4384 KB Output is correct
20 Correct 24 ms 4480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 3892 KB Output is correct
2 Correct 6 ms 3864 KB Output is correct
3 Correct 5 ms 3516 KB Output is correct
4 Correct 4 ms 3476 KB Output is correct
5 Correct 7 ms 4052 KB Output is correct
6 Correct 7 ms 4532 KB Output is correct
7 Correct 8 ms 4288 KB Output is correct
8 Correct 8 ms 3896 KB Output is correct
9 Correct 11 ms 3360 KB Output is correct
10 Correct 8 ms 3676 KB Output is correct
11 Correct 8 ms 4068 KB Output is correct
12 Correct 8 ms 4112 KB Output is correct
13 Correct 12 ms 4128 KB Output is correct
14 Correct 16 ms 3956 KB Output is correct
15 Correct 24 ms 4572 KB Output is correct
16 Correct 24 ms 4280 KB Output is correct
17 Correct 24 ms 4416 KB Output is correct
18 Correct 24 ms 3932 KB Output is correct
19 Correct 23 ms 4384 KB Output is correct
20 Correct 24 ms 4480 KB Output is correct
21 Correct 37 ms 4456 KB Output is correct
22 Correct 55 ms 4568 KB Output is correct
23 Correct 53 ms 4736 KB Output is correct
24 Correct 54 ms 4584 KB Output is correct
25 Correct 54 ms 4564 KB Output is correct
26 Correct 51 ms 4440 KB Output is correct
27 Correct 52 ms 5036 KB Output is correct
28 Correct 51 ms 4344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 3892 KB Output is correct
2 Correct 6 ms 3864 KB Output is correct
3 Correct 5 ms 3516 KB Output is correct
4 Correct 4 ms 3476 KB Output is correct
5 Correct 7 ms 4052 KB Output is correct
6 Correct 7 ms 4532 KB Output is correct
7 Correct 8 ms 4288 KB Output is correct
8 Correct 8 ms 3896 KB Output is correct
9 Correct 11 ms 3360 KB Output is correct
10 Correct 8 ms 3676 KB Output is correct
11 Correct 8 ms 4068 KB Output is correct
12 Correct 8 ms 4112 KB Output is correct
13 Correct 12 ms 4128 KB Output is correct
14 Correct 16 ms 3956 KB Output is correct
15 Correct 24 ms 4572 KB Output is correct
16 Correct 24 ms 4280 KB Output is correct
17 Correct 24 ms 4416 KB Output is correct
18 Correct 24 ms 3932 KB Output is correct
19 Correct 23 ms 4384 KB Output is correct
20 Correct 24 ms 4480 KB Output is correct
21 Correct 37 ms 4456 KB Output is correct
22 Correct 55 ms 4568 KB Output is correct
23 Correct 53 ms 4736 KB Output is correct
24 Correct 54 ms 4584 KB Output is correct
25 Correct 54 ms 4564 KB Output is correct
26 Correct 51 ms 4440 KB Output is correct
27 Correct 52 ms 5036 KB Output is correct
28 Correct 51 ms 4344 KB Output is correct
29 Correct 74 ms 4340 KB Output is correct
30 Correct 105 ms 4300 KB Output is correct
31 Correct 97 ms 4136 KB Output is correct
32 Correct 99 ms 4404 KB Output is correct
33 Correct 103 ms 4020 KB Output is correct
34 Correct 99 ms 4316 KB Output is correct
35 Correct 102 ms 4408 KB Output is correct
36 Correct 100 ms 4904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 3892 KB Output is correct
2 Correct 6 ms 3864 KB Output is correct
3 Correct 5 ms 3516 KB Output is correct
4 Correct 4 ms 3476 KB Output is correct
5 Correct 7 ms 4052 KB Output is correct
6 Correct 7 ms 4532 KB Output is correct
7 Correct 8 ms 4288 KB Output is correct
8 Correct 8 ms 3896 KB Output is correct
9 Correct 11 ms 3360 KB Output is correct
10 Correct 8 ms 3676 KB Output is correct
11 Correct 8 ms 4068 KB Output is correct
12 Correct 8 ms 4112 KB Output is correct
13 Correct 12 ms 4128 KB Output is correct
14 Correct 16 ms 3956 KB Output is correct
15 Correct 24 ms 4572 KB Output is correct
16 Correct 24 ms 4280 KB Output is correct
17 Correct 24 ms 4416 KB Output is correct
18 Correct 24 ms 3932 KB Output is correct
19 Correct 23 ms 4384 KB Output is correct
20 Correct 24 ms 4480 KB Output is correct
21 Correct 37 ms 4456 KB Output is correct
22 Correct 55 ms 4568 KB Output is correct
23 Correct 53 ms 4736 KB Output is correct
24 Correct 54 ms 4584 KB Output is correct
25 Correct 54 ms 4564 KB Output is correct
26 Correct 51 ms 4440 KB Output is correct
27 Correct 52 ms 5036 KB Output is correct
28 Correct 51 ms 4344 KB Output is correct
29 Correct 74 ms 4340 KB Output is correct
30 Correct 105 ms 4300 KB Output is correct
31 Correct 97 ms 4136 KB Output is correct
32 Correct 99 ms 4404 KB Output is correct
33 Correct 103 ms 4020 KB Output is correct
34 Correct 99 ms 4316 KB Output is correct
35 Correct 102 ms 4408 KB Output is correct
36 Correct 100 ms 4904 KB Output is correct
37 Incorrect 18 ms 588 KB invalid len
38 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 3892 KB Output is correct
2 Correct 6 ms 3864 KB Output is correct
3 Correct 5 ms 3516 KB Output is correct
4 Correct 4 ms 3476 KB Output is correct
5 Correct 7 ms 4052 KB Output is correct
6 Correct 7 ms 4532 KB Output is correct
7 Correct 8 ms 4288 KB Output is correct
8 Correct 8 ms 3896 KB Output is correct
9 Correct 11 ms 3360 KB Output is correct
10 Correct 8 ms 3676 KB Output is correct
11 Correct 8 ms 4068 KB Output is correct
12 Correct 8 ms 4112 KB Output is correct
13 Correct 12 ms 4128 KB Output is correct
14 Correct 16 ms 3956 KB Output is correct
15 Correct 24 ms 4572 KB Output is correct
16 Correct 24 ms 4280 KB Output is correct
17 Correct 24 ms 4416 KB Output is correct
18 Correct 24 ms 3932 KB Output is correct
19 Correct 23 ms 4384 KB Output is correct
20 Correct 24 ms 4480 KB Output is correct
21 Correct 37 ms 4456 KB Output is correct
22 Correct 55 ms 4568 KB Output is correct
23 Correct 53 ms 4736 KB Output is correct
24 Correct 54 ms 4584 KB Output is correct
25 Correct 54 ms 4564 KB Output is correct
26 Correct 51 ms 4440 KB Output is correct
27 Correct 52 ms 5036 KB Output is correct
28 Correct 51 ms 4344 KB Output is correct
29 Correct 74 ms 4340 KB Output is correct
30 Correct 105 ms 4300 KB Output is correct
31 Correct 97 ms 4136 KB Output is correct
32 Correct 99 ms 4404 KB Output is correct
33 Correct 103 ms 4020 KB Output is correct
34 Correct 99 ms 4316 KB Output is correct
35 Correct 102 ms 4408 KB Output is correct
36 Correct 100 ms 4904 KB Output is correct
37 Incorrect 18 ms 588 KB invalid len
38 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 3892 KB Output is correct
2 Correct 6 ms 3864 KB Output is correct
3 Correct 5 ms 3516 KB Output is correct
4 Correct 4 ms 3476 KB Output is correct
5 Correct 7 ms 4052 KB Output is correct
6 Correct 7 ms 4532 KB Output is correct
7 Correct 8 ms 4288 KB Output is correct
8 Correct 8 ms 3896 KB Output is correct
9 Correct 11 ms 3360 KB Output is correct
10 Correct 8 ms 3676 KB Output is correct
11 Correct 8 ms 4068 KB Output is correct
12 Correct 8 ms 4112 KB Output is correct
13 Correct 12 ms 4128 KB Output is correct
14 Correct 16 ms 3956 KB Output is correct
15 Correct 24 ms 4572 KB Output is correct
16 Correct 24 ms 4280 KB Output is correct
17 Correct 24 ms 4416 KB Output is correct
18 Correct 24 ms 3932 KB Output is correct
19 Correct 23 ms 4384 KB Output is correct
20 Correct 24 ms 4480 KB Output is correct
21 Correct 37 ms 4456 KB Output is correct
22 Correct 55 ms 4568 KB Output is correct
23 Correct 53 ms 4736 KB Output is correct
24 Correct 54 ms 4584 KB Output is correct
25 Correct 54 ms 4564 KB Output is correct
26 Correct 51 ms 4440 KB Output is correct
27 Correct 52 ms 5036 KB Output is correct
28 Correct 51 ms 4344 KB Output is correct
29 Correct 74 ms 4340 KB Output is correct
30 Correct 105 ms 4300 KB Output is correct
31 Correct 97 ms 4136 KB Output is correct
32 Correct 99 ms 4404 KB Output is correct
33 Correct 103 ms 4020 KB Output is correct
34 Correct 99 ms 4316 KB Output is correct
35 Correct 102 ms 4408 KB Output is correct
36 Correct 100 ms 4904 KB Output is correct
37 Incorrect 18 ms 588 KB invalid len
38 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 3892 KB Output is correct
2 Correct 6 ms 3864 KB Output is correct
3 Correct 5 ms 3516 KB Output is correct
4 Correct 4 ms 3476 KB Output is correct
5 Correct 7 ms 4052 KB Output is correct
6 Correct 7 ms 4532 KB Output is correct
7 Correct 8 ms 4288 KB Output is correct
8 Correct 8 ms 3896 KB Output is correct
9 Correct 11 ms 3360 KB Output is correct
10 Correct 8 ms 3676 KB Output is correct
11 Correct 8 ms 4068 KB Output is correct
12 Correct 8 ms 4112 KB Output is correct
13 Correct 12 ms 4128 KB Output is correct
14 Correct 16 ms 3956 KB Output is correct
15 Correct 24 ms 4572 KB Output is correct
16 Correct 24 ms 4280 KB Output is correct
17 Correct 24 ms 4416 KB Output is correct
18 Correct 24 ms 3932 KB Output is correct
19 Correct 23 ms 4384 KB Output is correct
20 Correct 24 ms 4480 KB Output is correct
21 Correct 37 ms 4456 KB Output is correct
22 Correct 55 ms 4568 KB Output is correct
23 Correct 53 ms 4736 KB Output is correct
24 Correct 54 ms 4584 KB Output is correct
25 Correct 54 ms 4564 KB Output is correct
26 Correct 51 ms 4440 KB Output is correct
27 Correct 52 ms 5036 KB Output is correct
28 Correct 51 ms 4344 KB Output is correct
29 Correct 74 ms 4340 KB Output is correct
30 Correct 105 ms 4300 KB Output is correct
31 Correct 97 ms 4136 KB Output is correct
32 Correct 99 ms 4404 KB Output is correct
33 Correct 103 ms 4020 KB Output is correct
34 Correct 99 ms 4316 KB Output is correct
35 Correct 102 ms 4408 KB Output is correct
36 Correct 100 ms 4904 KB Output is correct
37 Incorrect 18 ms 588 KB invalid len
38 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 3892 KB Output is correct
2 Correct 6 ms 3864 KB Output is correct
3 Correct 5 ms 3516 KB Output is correct
4 Correct 4 ms 3476 KB Output is correct
5 Correct 7 ms 4052 KB Output is correct
6 Correct 7 ms 4532 KB Output is correct
7 Correct 8 ms 4288 KB Output is correct
8 Correct 8 ms 3896 KB Output is correct
9 Correct 11 ms 3360 KB Output is correct
10 Correct 8 ms 3676 KB Output is correct
11 Correct 8 ms 4068 KB Output is correct
12 Correct 8 ms 4112 KB Output is correct
13 Correct 12 ms 4128 KB Output is correct
14 Correct 16 ms 3956 KB Output is correct
15 Correct 24 ms 4572 KB Output is correct
16 Correct 24 ms 4280 KB Output is correct
17 Correct 24 ms 4416 KB Output is correct
18 Correct 24 ms 3932 KB Output is correct
19 Correct 23 ms 4384 KB Output is correct
20 Correct 24 ms 4480 KB Output is correct
21 Correct 37 ms 4456 KB Output is correct
22 Correct 55 ms 4568 KB Output is correct
23 Correct 53 ms 4736 KB Output is correct
24 Correct 54 ms 4584 KB Output is correct
25 Correct 54 ms 4564 KB Output is correct
26 Correct 51 ms 4440 KB Output is correct
27 Correct 52 ms 5036 KB Output is correct
28 Correct 51 ms 4344 KB Output is correct
29 Correct 74 ms 4340 KB Output is correct
30 Correct 105 ms 4300 KB Output is correct
31 Correct 97 ms 4136 KB Output is correct
32 Correct 99 ms 4404 KB Output is correct
33 Correct 103 ms 4020 KB Output is correct
34 Correct 99 ms 4316 KB Output is correct
35 Correct 102 ms 4408 KB Output is correct
36 Correct 100 ms 4904 KB Output is correct
37 Incorrect 18 ms 588 KB invalid len
38 Halted 0 ms 0 KB -