제출 #289082

#제출 시각아이디문제언어결과실행 시간메모리
289082phillipRectangles (IOI19_rect)C++14
0 / 100
77 ms768 KiB
#include "rect.h" #include <bits/stdc++.h> #define ll long long #define fast cin.tie(0);cout.tie(0); #define order ios::sync_with_stdio(0);ios_base::sync_with_stdio(0); #define pb push_back using namespace std; int n,m,a[2509][2509]; ll k[2509][2509],mn[2509][2509]; ll ans; void chl(int x) { multiset<int>s; for(int i=0;i<m;i++) { ////<<i; auto it=s.lower_bound(a[x][i]+1); k[x][i]=0; if(it==s.end()) { s.clear(); mn[x][i]=0; s.insert(a[x][i]); continue; } for(it;it!=s.end();it++)k[x][i]++; if(s.find(a[x][i])!=s.end())s.erase(a[x][i]); s.insert(a[x][i]); it=s.begin(); for(it;it!=s.end();it++) { int xx=*it; if(xx==a[x][i])break; auto itt=it; it++; s.erase(itt); } mn[x][i]=min(mn[x][i],k[x][i]); // //<<'.';//<<'/'; } //<<" "; s.clear(); for(int i=m-1;i>=0;i--) { auto it=s.lower_bound(a[x][i]+1); k[x][i]=0; if(it==s.end()) { s.clear(); mn[x][i]=0; k[x][i]=0; s.insert(a[x][i]); continue; } for(it;it!=s.end();it++)k[x][i]++; if(s.find(a[x][i])!=s.end())s.erase(a[x][i]); s.insert(a[x][i]); it=s.begin(); for(it;it!=s.end();it++) { int xx=*it; if(xx==a[x][i])break; auto itt=it; it++; s.erase(itt); } mn[x][i]=min(mn[x][i],k[x][i]); } //<<"\n"; } void chu(int y) { multiset<int>s; for(int i=0;i<n;i++) { auto it=s.lower_bound(a[i][y]+1); k[i][y]=0; if(it==s.end()) { s.clear(); mn[i][y]=0; k[i][y]=0; s.insert(a[i][y]); continue; } for(it;it!=s.end();it++)k[i][y]++; if(s.find(a[i][y])!=s.end())s.erase(a[i][y]); s.insert(a[i][y]); it=s.begin(); for(it;it!=s.end();it++) { int xx=*it; if(xx==a[i][y])break; auto itt=it; it++; s.erase(itt); } mn[i][y]=min(mn[i][y],k[i][y]); } //<<" "; s.clear(); for(int i=n;i>=0;i--) { auto it=s.lower_bound(a[i][y]+1); k[i][y]=0; if(it==s.end()) { s.clear(); mn[i][y]=0; k[i][y]=0; s.insert(a[i][y]); continue; } for(it;it!=s.end();it++)k[i][y]++; if(s.find(a[i][y])!=s.end())s.erase(a[i][y]); s.insert(a[i][y]); it=s.begin(); for(it;it!=s.end();it++) { int xx=*it; if(xx==a[i][y])break; auto itt=it; it++; s.erase(itt); } mn[i][y]=min(mn[i][y],k[i][y]); } //<<"\n"; } long long count_rectangles(std::vector<std::vector<int> > aa) { n=aa.size();m=aa[0].size(); for(int i=0;i<n;i++) { for(int j=0;j<m;j++){a[i][j]=aa[i][j];mn[i][j]=1e8;} } for(int i=0;i<n;i++) { ////<<i<<" "; chl(i); } //<<"\n"; for(int i=0;i<m;i++)chu(i); for(int i=0;i<n;i++) { for(int j=0;j<m;j++)ans+=mn[i][j]; } return ans; }

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

rect.cpp: In function 'void chl(int)':
rect.cpp:26:13: warning: statement has no effect [-Wunused-value]
   26 |         for(it;it!=s.end();it++)k[x][i]++;
      |             ^~
rect.cpp:31:13: warning: statement has no effect [-Wunused-value]
   31 |         for(it;it!=s.end();it++)
      |             ^~
rect.cpp:56:13: warning: statement has no effect [-Wunused-value]
   56 |         for(it;it!=s.end();it++)k[x][i]++;
      |             ^~
rect.cpp:60:13: warning: statement has no effect [-Wunused-value]
   60 |         for(it;it!=s.end();it++)
      |             ^~
rect.cpp: In function 'void chu(int)':
rect.cpp:88:13: warning: statement has no effect [-Wunused-value]
   88 |         for(it;it!=s.end();it++)k[i][y]++;
      |             ^~
rect.cpp:92:13: warning: statement has no effect [-Wunused-value]
   92 |         for(it;it!=s.end();it++)
      |             ^~
rect.cpp:116:13: warning: statement has no effect [-Wunused-value]
  116 |         for(it;it!=s.end();it++)k[i][y]++;
      |             ^~
rect.cpp:120:13: warning: statement has no effect [-Wunused-value]
  120 |         for(it;it!=s.end();it++)
      |             ^~
#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...