제출 #1082502

#제출 시각아이디문제언어결과실행 시간메모리
1082502ItamarRectangles (IOI19_rect)C++14
13 / 100
825 ms862116 KiB
#include "rect.h" #include<bits/stdc++.h> #define vi vector<int> #define pi pair<int,int> using namespace std; const int siz = 2502; vector<pi> con[siz][siz]; bool vis[siz][siz]; vector<vi> A; int n,m; #define ckmin(a,b) a=min(a,b); #define ckmax(a,b) a = max(a,b); void dfs(int a, int b, int ora,int orb){ if(a<0 || a>=n || b < 0 || b >= m )return; if(A[a][b])return; if(vis[a][b])return; vis[a][b]=1; con[ora][orb].push_back({a,b}); for(int i = -1; i < 2; i+=2){ dfs(a+i,b,ora,orb); dfs(a,b+i,ora,orb); } } bool rect(vector<pi> v){ int minix = n, miniy = m, maxix=-1,maxiy=-1; for(auto[a,b] : v){ ckmin(minix,a); ckmin(miniy,b); ckmax(maxix,a); ckmax(maxiy,b); if(a==0 || a == n-1 || b == 0 || b == m-1)return 0; } return v.size() == (maxix-minix+1)*(maxiy-miniy+1); } long long count_rectangles(std::vector<std::vector<int> > a) { int ans = 0; A=a; n = A.size(), m = A[0].size(); for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ dfs(i,j,i,j); } } for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++)if(con[i][j].size())ans+=rect(con[i][j]); } return ans; }

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

rect.cpp: In function 'bool rect(std::vector<std::pair<int, int> >)':
rect.cpp:27:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   27 |  for(auto[a,b] : v){
      |          ^
rect.cpp:35:18: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   35 |  return v.size() == (maxix-minix+1)*(maxiy-miniy+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...