제출 #1244307

#제출 시각아이디문제언어결과실행 시간메모리
1244307cpdreamerSoccer Stadium (IOI23_soccer)C++17
컴파일 에러
0 ms0 KiB
#include "soccer.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; const long long INF = 1e18+1; typedef long long ll; const ll MOD = 1e9+7; #define P pair #define S second #define pb push_back #define all(v) v.begin(), v.end() #define V vector typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set; bool cus(P<int,int>a,P<int,int>b) { return a.second-a.first>b.second-b.first; } bool cus(P<int,int>a,P<int,int>b) { return a.second-a.first>b.second-b.first; } int biggest_stadium(int N, std::vector<std::vector<int>> F) { V<P<int,int>>row,col; int c=0; for (int i=0;i<N;i++) { for (int j=0;j<N;j++) { F[i][j]=!F[i][j]; if (F[i][j]) { c++; } } } for (int i=0;i<N;i++) { V<int>v; for (int j=0;j<N;j++) { if (F[i][j]) { v.pb(j); } } for (int j=0;j<(int)v.size()-1;j++) { if (v[j+1]-v[j]!=1) { return 0; } } int l=-1,r=-1; for (int j=0;j<N;j++) { if (F[i][j]) { l=j; break; } } for (int j=0;j<N;j++) { if (F[i][j]) { r=j; } } if (l!=-1 )row.pb({l,r}); } for (int i=0;i<N;i++) { V<int>v; for (int j=0;j<N;j++) { if (F[j][i]) { v.pb(j); } } for (int j=0;j<(int)v.size()-1;j++) { if (v[j+1]-v[j]!=1) { return 0; } } int l=-1,r=-1; for (int j=0;j<N;j++) { if (F[j][i]) { l=j; break; } } for (int j=0;j<N;j++) { if (F[j][i]) { r=j; } } if (l!=-1 )col.pb({l,r}); } sort(all(row),cus); sort(all(col),cus); for (int i=0;i<(int)row.size()-1;i++) { if (row[i].first>row[i+1].first || row[i].second<row[i+1].second)return 0; } for (int i=0;i<(int)col.size()-1;i++) { if (col[i].first>col[i+1].first || col[i].second<col[i+1].second)return 0; } return c; }

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

soccer.cpp:19:6: error: redefinition of 'bool cus(std::pair<int, int>, std::pair<int, int>)'
   19 | bool cus(P<int,int>a,P<int,int>b) {
      |      ^~~
soccer.cpp:16:6: note: 'bool cus(std::pair<int, int>, std::pair<int, int>)' previously defined here
   16 | bool cus(P<int,int>a,P<int,int>b) {
      |      ^~~