제출 #619096

#제출 시각아이디문제언어결과실행 시간메모리
619096Dremix10Aliens (IOI16_aliens)C++17
0 / 100
1 ms316 KiB
#include "aliens.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pi; typedef pair<ll,ll> pl; #define endl '\n' #define all(x) (x).begin(),(x).end() #define F first #define S second #ifdef dremix #define p(x) cerr<<#x<<" = "<<x<<endl; #define p2(x,y) cerr<<#x<<" , "<<#y<<" = "<<x<<" , "<<y<<endl; #define pp(x) cerr<<#x<<" = "<<x.F<<"-"<<x.S<<endl; #define pv(x) cerr<<#x<<" = {";for(auto v : x)cerr<<v<<", ";cerr<<"}"<<endl; #define ppv(x) cerr<<#x<<" = {";for(auto v : x)cerr<<v.F<<"-"<<v.S<<", ";cerr<<"}"<<endl; #else #define p(x) {} #define p2(x,y) {} #define pp(x) {} #define pv(x) {} #define ppv(x) {} #endif const int N = 1005; const int MOD = 1e9+7; const ll INF = 1e18+5; struct ano{ int x,y,id; }; bool cmp(ano a, ano b){ return min(a.x,a.y) > min(b.x,b.y); } bool v[N][N]; void clean(vector<ano> &a){ while(!a.empty() && v[a.back().x][a.back().y]) a.pop_back(); } void print(vector<ano> &arr){ return; for(auto x : arr){ cerr<<x.x<<" "<<x.y<<" "<<x.id<<endl; } } long long take_photos(int n, int m, int K, std::vector<int> r, std::vector<int> c) { int i,j,k; vector<ano> arr(n); for(i=0;i<n;i++){ arr[i] = {r[i],c[i],i}; } sort(all(arr),cmp); //bool v[m][m] = {}; int p = 0; int ans = 0; for(i=0;i<n;i++){ clean(arr); if(arr.empty())break; if(arr.back().x != i && arr.back().y != i)continue; int maxi = 0; print(arr); do{ maxi = max(maxi,max(arr.back().x,arr.back().y)); arr.pop_back(); clean(arr); }while(!arr.empty() && arr.back().x == i || arr.back().y == i); for(j=i;j<=maxi;j++)for(k=i;k<=maxi;k++){ ans += v[j][k] == false; v[j][k] = true; } p2(i,ans) p(maxi) } return ans; }

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

aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:77:29: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   77 |         }while(!arr.empty() && arr.back().x == i || arr.back().y == i);
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
aliens.cpp:61:9: warning: unused variable 'p' [-Wunused-variable]
   61 |     int p = 0;
      |         ^
#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...