Submission #147098

#TimeUsernameProblemLanguageResultExecution timeMemory
147098NucleistRectangles (IOI19_rect)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "rect.h" using namespace std; #define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define debug(x) cerr << " - " << #x << ": " << x << endl; #define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl; #define all(x) (x).begin(),(x).end() #define sz(x) (ll)x.size() #define ll long long #define INF 1000000000 #define pb push_back struct greateri { template<class T> bool operator()(T const &a, T const &b) const { return a > b; } }; vector<vector<ll>>floodfill; ll topx,topy,botx,boty; ll last; ll n,m; ll dir[4][2]={{0,1},{1,0},{-1,0},{0,-1}}; void dfs(ll x,ll y) { topx=max(topx,x),topy=max(topy,y),botx=min(botx,x),boty=min(boty,y); floodfill[x][y]=last; for (ll i = 0; i < 4; ++i) { ll nextx=x+dir[i][0],nexty=y+dir[i][1]; if(floodfill[nextx][nexty]==0) dfs(nextx,nexty); } } ll count_rectangles(vector<vector<int>>X) { //flash; n = sz(X); // 2 rows m = sz(X[0]); floodfill=X; for (ll i = 0; i < n; ++i) { for (ll j = 0; j < m; ++j) { if(i==0 || j==0 || i==n-1 || j==m-1)floodfill[i][j]=1; } } last=1; ll ans=0; for (ll i = 1; i < n-1; ++i) { for (ll j = 1; j < m-1; ++j) { if(floodfill[i][j]==0) { last++; topy=boty=j,topx=botx=i; dfs(i,j); ll topi = floodfill[topx][topy]; ll yopi = floodfill[topx][boty]; ll dopi = floodfill[botx][boty]; ll kopo = floodfill[botx][topy]; if(topi==yopi && yopi==dopi && dopi==kopo)ans++; } } } return ans; } //code the AC sol ! // BS/queue/map

Compilation message (stderr)

rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:38:13: error: no match for 'operator=' (operand types are 'std::vector<std::vector<long long int> >' and 'std::vector<std::vector<int> >')
   floodfill=X;
             ^
In file included from /usr/include/c++/7/vector:69:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from rect.cpp:1:
/usr/include/c++/7/bits/vector.tcc:179:5: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]
     vector<_Tp, _Alloc>::
     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/vector.tcc:179:5: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'const std::vector<std::vector<long long int> >&'
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from rect.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:461:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]
       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:461:7: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'std::vector<std::vector<long long int> >&&'
/usr/include/c++/7/bits/stl_vector.h:482:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]
       operator=(initializer_list<value_type> __l)
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:482:7: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'std::initializer_list<std::vector<long long int> >'