제출 #289730

#제출 시각아이디문제언어결과실행 시간메모리
289730OzyRectangles (IOI19_rect)C++17
0 / 100
6 ms768 KiB
#include "rect.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i = (a); i <= (b); i++) #define lli long long int #define debug(a) cout << #a << " = " << a << endl struct x{ lli fila; lli colu; }; lli hijos[8] = {1,-1,0,0,0,0,1,-1}; lli visitados[2502][2502]; lli arr[2500][2500]; lli fil,col,res; queue<x> cola; bool checa(int f, int c) { lli f1,f2,c1,c2,sum,x1,y1; x act; f1 = f; f2 = f; c1 = c; c2 = c; sum = 0; cola.push({f,c}); while (!cola.empty()) { act = cola.front(); cola.pop(); if (visitados[act.fila][act.colu] == 0) { visitados[act.fila][act.colu] = 1; sum++; f1 = max(f1,act.fila); f2 = min(f2,act.fila); c1 = max(c1,act.colu); c2 = min(c2,act.colu); rep(i,0,3) { x1 = hijos[i]; y1 = hijos[i+4]; if (visitados[x1][y1] == 0 && arr[x1][y1] == 0) cola.push({x1,y1}); } } } x1 = (f1-f2+1)*(c1-c2+1); if (res == x1) return true; else return false; } long long count_rectangles(std::vector<std::vector<int> > a) { fil = a.size(); col = a[0].size(); rep(i,0,fil-1) { rep(j,0,col-1) { arr[i][j] = a[i][j]; } } res = 0; rep(i,1,fil-2) { rep(j,1,col-2) { if (visitados[i][j] == 0 && a[i][j] == 0) if (checa(i,j)) res++; } } }

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

rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:78:1: warning: no return statement in function returning non-void [-Wreturn-type]
   78 | }
      | ^
#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...