Submission #984356

#TimeUsernameProblemLanguageResultExecution timeMemory
984356thelegendary08Mars (APIO22_mars)C++17
0 / 100
0 ms348 KiB
#include "mars.h" #include<bits/stdc++.h> #define pb push_back #define ll long long int #define vi vector<int> #define vvi vector<vector<int>> #define vll vector<long long int> #define vvll vector<vector<long long int>> #define pii pair<int, int> #define vpii vector<pair<int, int>> #define vpll vector<pair<long long int, long long int>> #define pqpll priority_queue<pair<long long int, long long int>> #define vc vector<char> #define vvc vector<vector<char>> #define vb vector<bool> #define mii map<int,int> #define mll map<long long int, long long int> #define mivi map<int,vector<int>> #define f0r(i,n) for(int i=0;i<n;i++) #define FOR(i,k,n) for(int i=k;i<n;i++) using namespace std; std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n) { string ret; if(k == 0){ f0r(ii, 100)ret += '0'; f0r(ii, 3){ f0r(jj, 3){ ret[(i + ii) * (2*n+1) + (j + jj)] = '1'; } } return ret; } else{ ret = a[0][0]; f0r(ii, 3){ f0r(jj, 3){ f0r(cur, 100){ if(a[ii][jj][cur] == '1')ret[i] = '1'; } } } } if(k == n-1){ int grid[2*n+1][2*n+1]; f0r(ii, 2*n+1){ f0r(jj, 2*n+1){ grid[ii][jj] = ret[ii * (2 * n + 1) + jj]; } } queue<pair<int,int>>q; bool vis[2*n+1][2*n+1]; f0r(ii, 2*n+1)f0r(jj, 2*n+1)vis[ii][jj] = 0; int ccs = 0; f0r(ii, 2*n+1){ f0r(jj, 2*n+1){ if(!vis[ii][jj]){ ccs++; q.push({ii, jj}); vis[ii][jj] = 1; while(!q.empty()){ pii cur = q.front(); q.pop(); vpii nxt; int a = cur.first; int b = cur.second; if(a != 0)nxt.pb({a-1, b}); if(a != 2*n)nxt.pb({a+1, b}); if(b != 0)nxt.pb({a, b-1}); if(b != 2*n)nxt.pb({a, b+1}); for(pii u : nxt){ if(vis[u.first][u.second])continue; vis[u.first][u.second] = 1; q.push({u.first, u.second}); } } } } } string ans = ""; f0r(ii, 20){ if(ccs & (1<<ii))ans += '1'; else ans+='0'; } f0r(ii, 80)ans+='0'; return ans; } return ret; }

Compilation message (stderr)

mars.cpp: In function 'std::string process(std::vector<std::vector<std::__cxx11::basic_string<char> > >, int, int, int, int)':
mars.cpp:49:13: warning: variable 'grid' set but not used [-Wunused-but-set-variable]
   49 |         int grid[2*n+1][2*n+1];
      |             ^~~~
#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...