Submission #147123

#TimeUsernameProblemLanguageResultExecution timeMemory
147123NucleistRectangles (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; } }; int topx,topy,botx,boty; int last; int n,m; int dir[4][2]={{0,1},{1,0},{-1,0},{0,-1}}; void dfs(int x,int y,int *X) { topx=max(topx,x),topy=max(topy,y),botx=min(botx,x),boty=min(boty,y); X[x][y]=last; for (int i = 0; i < 4; ++i) { int nextx=x+dir[i][0],nexty=y+dir[i][1]; if(X[nextx][nexty]==0) dfs(nextx,nexty); } } ll count_rectangles(vector<vector<int>>X) { //flash; n = sz(X); // 2 rows m = sz(X[0]); last=1; ll ans=0; for (int i = 1; i < n-1; ++i) { for (int j = 1; j < m-1; ++j) { if(X[i][j]==0) { last++; topy=boty=j,topx=botx=i; dfs(i,j,X); int topi = X[topx][topy]; int yopi = X[topx][boty]; int dopi = X[botx][boty]; int kopo = X[botx][topy]; if(topi==yopi && yopi==dopi && dopi==kopo &&(topx!=n-1 && topy!=m-1 && botx!=0 && boty!=0))ans++; } } } return ans; } //code the AC sol ! // BS/queue/map

Compilation message (stderr)

rect.cpp: In function 'void dfs(int, int, int*)':
rect.cpp:24:8: error: invalid types 'int[int]' for array subscript
  X[x][y]=last;
        ^
rect.cpp:28:20: error: invalid types 'int[int]' for array subscript
   if(X[nextx][nexty]==0)
                    ^
rect.cpp:29:19: error: too few arguments to function 'void dfs(int, int, int*)'
    dfs(nextx,nexty);
                   ^
rect.cpp:21:6: note: declared here
 void dfs(int x,int y,int *X)
      ^~~
rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:47:15: error: cannot convert 'std::vector<std::vector<int> >' to 'int*' for argument '3' to 'void dfs(int, int, int*)'
      dfs(i,j,X);
               ^