Submission #622622

#TimeUsernameProblemLanguageResultExecution timeMemory
622622Dremix10Vision Program (IOI19_vision)C++17
33 / 100
7 ms1104 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pi; typedef pair<ll,ll> pl; #define F first #define S second #define all(x) (x).begin(),(x).end() #ifdef dremix #define p(x) cerr<<#x<<" = "<<x<<endl; #define p2(x,y) cerr<<#x<<" , "<<#y<<" = "<<x<<" , "<<y<<endl; #define pp(x) cerr<<#x<<" = "<<x.F<<"-"<<x.S<<endl; #define pv(x) cerr<<#x<<" = {";for(auto v : x)cerr<<v<<", ";cerr<<"}"<<endl; #define ppv(x) cerr<<#x<<" = {";for(auto v : x)cerr<<v.F<<"-"<<v.S<<", ";cerr<<"}"<<endl; #else #define p(x) {} #define p2(x,y) {} #define pp(x) {} #define pv(x) {} #define ppv(x) {} #endif //const int N = 3e5+5; const int MOD = 1e9+7; const ll INF = 1e18+5; int N,M; int foo(pi x){ return x.F*M+x.S; } pi oof(int x){ return {x/M,x%M}; } int di[] = {1,0,-1,0}; int dj[] = {0,1,0,-1}; void print(queue<pi> q){ #ifdef dremix while(!q.empty()){ pp(oof(q.front().F)) q.pop(); } #endif } void construct_network(int n, int m, int K) { int i,j,k; N = n; M = m; vector<int> chk; for(i=0;i<n;i++)for(j=0;j<m;j++){ queue<pi> q; q.push({foo({i,j}),0}); bool v[n][m] = {}; v[i][j] = true; while(!q.empty()){ if(q.front().S == K)break; pi temp = q.front(); q.pop(); pi x = oof(temp.F); pp(x) p(temp.S) for(k=0;k<4;k++){ int ni = x.F + di[k]; int nj = x.S + dj[k]; if(ni < 0 || ni >= n || nj < 0 || nj >= m)continue; if(v[ni][nj])continue; q.push({foo({ni,nj}),temp.S+1}); v[ni][nj] = true; } } pp(make_pair(i,j)) print(q); while(!q.empty()){ chk.push_back(add_and({q.front().F,foo({i,j})})); assert(q.front().S == K); q.pop(); } } pv(chk) int idx = add_or(chk); return; }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:92:6: warning: unused variable 'idx' [-Wunused-variable]
   92 |  int idx = add_or(chk);
      |      ^~~
#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...