# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
880681 | 2023-11-29T20:46:30 Z | mychecksedad | Mars (APIO22_mars) | C++17 | 0 ms | 580 KB |
// #include<mars.h> #include<bits/stdc++.h> using namespace std; #define ll long long int #define MOD (1000000000+7) #define MOD1 (998244353) #define pb push_back #define all(x) x.begin(), x.end() #define en cout << '\n' const int N = 1e6+100, M = 1e5+10, K = 52, MX = 30; struct Dsu { vector<int> s, p; int sz; Dsu(int n){ sz = n; s.resize(n+1, 1); p.resize(n+1); for(int i = 0; i <= n; ++i) p[i] = i; } int find(int v){ if(p[v] == v) return v; return (p[v] = find(p[v])); } void merge(int a, int b){ a = find(a); b = find(b); if(a != b){ if(s[a] > s[b]){ swap(a, b); } s[b] += s[a]; p[a] = b; sz--; } } }; std::string process(vector<vector<string>> a,int i,int j,int k,int n){ Dsu d(9); int zero; for(int i = 0; i < 3; ++i){ for(int j = 0; j < 3; ++j){ if(a[i][j][0] == '0'){ zero++; continue; } if(j < 2){ if(a[i][j][0] == '1' && a[i][j + 1][0] == '1') d.merge(i*3+j, i*3+j+1); } if(i < 2){ if(a[i][j][0] == '1' && a[i + 1][j][0] == '1') d.merge(i*3+j, i*3+j+3); } } } int val = d.sz - zero; string ans = ""; for(int i = 0; i < 100; ++i) ans.pb(' '); ans[0] = (val % 2) + '0'; ans[1] = ((val&2) > 0) + '0'; ans[2] = ((val&4) > 0) + '0'; return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 580 KB | invalid len |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 580 KB | invalid len |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 580 KB | invalid len |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 580 KB | invalid len |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 580 KB | invalid len |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 580 KB | invalid len |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 580 KB | invalid len |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 580 KB | invalid len |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 580 KB | invalid len |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 580 KB | invalid len |
2 | Halted | 0 ms | 0 KB | - |