제출 #1307327

#제출 시각아이디문제언어결과실행 시간메모리
1307327_as3adVision Program (IOI19_vision)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "vision.h" using namespace std; #define ll long long //#define int long long #define all(x) x.begin(), x.end() #define siz(x) ((int)x.size()) #define yes cout << "YES\n" #define no cout << "NO\n" #define f first #define s second /* #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; */ const int mod = 1e9+7; const int N = 20005; const long long inf = 1e12+12; double eps = 1e-9; vector<vector<int>> meto ( int h, int w, int k ) { vector<array<int,2>>vect; for(int i=0;i<h;++i){ for(int j=0;j<w;++j){ vect.push_back({i,j}); } } vector<vector<int>> ans( siz(vect)+3 ); for(int i =0;i<vect.size();++i){ for(int j =i+1;j<vect.size();++j){ int sz = abs(vect[i][0]-vect[j][0])+abs(vect[i][1]-vect[j][1]); if(sz==k) ans[i].push_back(j); ans[j].push_back(i); } } return ans; } /* add_and(Ns); add_or(Ns); add_xor(Ns); add_not(c); */ void construct_network(int h, int w, int k) { vector<vector<int>> hi = meto(h, w, k); vector<int> can; int cur = h*w-1; for ( int x=0; i<h; x++ ) { int i=x*w; if ( siz( hi[i] ) == 0 ) continue; add_or( hi[i] ); add_and( {cur+1, i} ); cur+=2; can.push_back(cur); } for (int i=0; i<w; i++) { if ( siz( hi[i] ) == 0 ) continue; add_or( hi[i] ); add_and( {cur+1, i} ); cur+=2; can.push_back(cur); } add_or( can ); }

컴파일 시 표준 에러 (stderr) 메시지

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:58:20: error: 'i' was not declared in this scope
   58 |     for ( int x=0; i<h; x++ ) {
      |                    ^
vision.cpp:62:16: error: could not convert '{(cur + 1), i}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   62 |         add_and( {cur+1, i} );
      |         ~~~~~~~^~~~~~~~~~~~~~
      |                |
      |                <brace-enclosed initializer list>