Submission #1035697

# Submission time Handle Problem Language Result Execution time Memory
1035697 2024-07-26T13:48:31 Z amine_aroua Mars (APIO22_mars) C++17
14 / 100
13 ms 3172 KB
#include "mars.h"
#include<bits/stdc++.h>
using namespace std;
int xx[4] = {1 , -1 , 0 , 0};
int yy[4] = {0 , 0 , -1 , 1};
std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n)
{
	string ret(100 , '0');
    int N = 2*n + 1;
	for(int x = i ; x <= i + 2 ; x++)
	{
		for(int y = j ; y <= j + 2 ; y++)
		{
			if(k == 0)
			{
				swap(a[x - i][y - j][0] , a[x - i][y - j][N * x + y]);
			}
			for(int z = 0 ; z < 100 ; z++)
			{
				ret[z]|=a[x - i][y - j][z];
			}
		}
	}
	if(k == n - 1)
	{
		vector<vector<bool>> vis(2 * n +1  , vector<bool>(2 * n + 1));
        int cnt = 0;
        auto dfs = [&](int x , int y , auto &&dfs)->void
        {
            if(vis[x][y])
            {
                return ;
            }
            vis[x][y] = 1;
            for(int K = 0 ; K < 4 ; K++)
            {
                int nx = x + xx[K] , ny = y + yy[K];
                if(nx >= 0 && ny >= 0 && nx < N && ny < N && ret[nx * N + ny] == '1')
                {
                    dfs(nx , ny, dfs);
                } 
            }
        };
        for(int x = 0 ;x < N ; x++)
        {
            for(int y = 0 ; y < N ; y++)
            {
                if(!vis[x][y] && ret[N * x + y] == '1')
                {
                    cnt++;
                    dfs(x , y , dfs);
                }
            }
        }
		string s(100 , '0');
        for(int x = 0 ; x < 20; x++)
        {
            if((1<<x) & cnt)
            {
                s[x] = '1';
            }
        }
        return s;
	}
    return ret;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2752 KB Output is correct
2 Correct 5 ms 2828 KB Output is correct
3 Correct 7 ms 2676 KB Output is correct
4 Correct 7 ms 2836 KB Output is correct
5 Correct 8 ms 2656 KB Output is correct
6 Correct 5 ms 3104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2752 KB Output is correct
2 Correct 5 ms 2828 KB Output is correct
3 Correct 7 ms 2676 KB Output is correct
4 Correct 7 ms 2836 KB Output is correct
5 Correct 8 ms 2656 KB Output is correct
6 Correct 5 ms 3104 KB Output is correct
7 Correct 8 ms 2924 KB Output is correct
8 Correct 12 ms 3172 KB Output is correct
9 Correct 10 ms 2744 KB Output is correct
10 Correct 12 ms 2748 KB Output is correct
11 Correct 10 ms 3056 KB Output is correct
12 Correct 13 ms 2740 KB Output is correct
13 Correct 9 ms 2828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2752 KB Output is correct
2 Correct 5 ms 2828 KB Output is correct
3 Correct 7 ms 2676 KB Output is correct
4 Correct 7 ms 2836 KB Output is correct
5 Correct 8 ms 2656 KB Output is correct
6 Correct 5 ms 3104 KB Output is correct
7 Correct 8 ms 2924 KB Output is correct
8 Correct 12 ms 3172 KB Output is correct
9 Correct 10 ms 2744 KB Output is correct
10 Correct 12 ms 2748 KB Output is correct
11 Correct 10 ms 3056 KB Output is correct
12 Correct 13 ms 2740 KB Output is correct
13 Correct 9 ms 2828 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2752 KB Output is correct
2 Correct 5 ms 2828 KB Output is correct
3 Correct 7 ms 2676 KB Output is correct
4 Correct 7 ms 2836 KB Output is correct
5 Correct 8 ms 2656 KB Output is correct
6 Correct 5 ms 3104 KB Output is correct
7 Correct 8 ms 2924 KB Output is correct
8 Correct 12 ms 3172 KB Output is correct
9 Correct 10 ms 2744 KB Output is correct
10 Correct 12 ms 2748 KB Output is correct
11 Correct 10 ms 3056 KB Output is correct
12 Correct 13 ms 2740 KB Output is correct
13 Correct 9 ms 2828 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2752 KB Output is correct
2 Correct 5 ms 2828 KB Output is correct
3 Correct 7 ms 2676 KB Output is correct
4 Correct 7 ms 2836 KB Output is correct
5 Correct 8 ms 2656 KB Output is correct
6 Correct 5 ms 3104 KB Output is correct
7 Correct 8 ms 2924 KB Output is correct
8 Correct 12 ms 3172 KB Output is correct
9 Correct 10 ms 2744 KB Output is correct
10 Correct 12 ms 2748 KB Output is correct
11 Correct 10 ms 3056 KB Output is correct
12 Correct 13 ms 2740 KB Output is correct
13 Correct 9 ms 2828 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2752 KB Output is correct
2 Correct 5 ms 2828 KB Output is correct
3 Correct 7 ms 2676 KB Output is correct
4 Correct 7 ms 2836 KB Output is correct
5 Correct 8 ms 2656 KB Output is correct
6 Correct 5 ms 3104 KB Output is correct
7 Correct 8 ms 2924 KB Output is correct
8 Correct 12 ms 3172 KB Output is correct
9 Correct 10 ms 2744 KB Output is correct
10 Correct 12 ms 2748 KB Output is correct
11 Correct 10 ms 3056 KB Output is correct
12 Correct 13 ms 2740 KB Output is correct
13 Correct 9 ms 2828 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2752 KB Output is correct
2 Correct 5 ms 2828 KB Output is correct
3 Correct 7 ms 2676 KB Output is correct
4 Correct 7 ms 2836 KB Output is correct
5 Correct 8 ms 2656 KB Output is correct
6 Correct 5 ms 3104 KB Output is correct
7 Correct 8 ms 2924 KB Output is correct
8 Correct 12 ms 3172 KB Output is correct
9 Correct 10 ms 2744 KB Output is correct
10 Correct 12 ms 2748 KB Output is correct
11 Correct 10 ms 3056 KB Output is correct
12 Correct 13 ms 2740 KB Output is correct
13 Correct 9 ms 2828 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2752 KB Output is correct
2 Correct 5 ms 2828 KB Output is correct
3 Correct 7 ms 2676 KB Output is correct
4 Correct 7 ms 2836 KB Output is correct
5 Correct 8 ms 2656 KB Output is correct
6 Correct 5 ms 3104 KB Output is correct
7 Correct 8 ms 2924 KB Output is correct
8 Correct 12 ms 3172 KB Output is correct
9 Correct 10 ms 2744 KB Output is correct
10 Correct 12 ms 2748 KB Output is correct
11 Correct 10 ms 3056 KB Output is correct
12 Correct 13 ms 2740 KB Output is correct
13 Correct 9 ms 2828 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2752 KB Output is correct
2 Correct 5 ms 2828 KB Output is correct
3 Correct 7 ms 2676 KB Output is correct
4 Correct 7 ms 2836 KB Output is correct
5 Correct 8 ms 2656 KB Output is correct
6 Correct 5 ms 3104 KB Output is correct
7 Correct 8 ms 2924 KB Output is correct
8 Correct 12 ms 3172 KB Output is correct
9 Correct 10 ms 2744 KB Output is correct
10 Correct 12 ms 2748 KB Output is correct
11 Correct 10 ms 3056 KB Output is correct
12 Correct 13 ms 2740 KB Output is correct
13 Correct 9 ms 2828 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2752 KB Output is correct
2 Correct 5 ms 2828 KB Output is correct
3 Correct 7 ms 2676 KB Output is correct
4 Correct 7 ms 2836 KB Output is correct
5 Correct 8 ms 2656 KB Output is correct
6 Correct 5 ms 3104 KB Output is correct
7 Correct 8 ms 2924 KB Output is correct
8 Correct 12 ms 3172 KB Output is correct
9 Correct 10 ms 2744 KB Output is correct
10 Correct 12 ms 2748 KB Output is correct
11 Correct 10 ms 3056 KB Output is correct
12 Correct 13 ms 2740 KB Output is correct
13 Correct 9 ms 2828 KB Output is correct
14 Runtime error 1 ms 332 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -