제출 #881037

#제출 시각아이디문제언어결과실행 시간메모리
881037abcvuitunggioHamburg Steak (JOI20_hamburg)C++17
6 / 100
80 ms16320 KiB
#include <bits/stdc++.h> using namespace std; const int INF=1e9; int n,k,l[200001],d[200001],r[200001],u[200001]; vector <pair <int, int>> res; vector <int> v; vector <int> f(vector <int> v, int x, int y){ vector <int> res; for (int i:v) if (l[i]>x||r[i]<x||d[i]>y||u[i]<y) res.push_back(i); return res; } bool solve(vector <int> v, int k){ if (v.empty()){ while (k--) res.push_back({1,1}); return true; } if (!k) return false; int mn=INF,mn2=INF,mx2=0; for (int i:v){ mn=min(mn,r[i]); mn2=min(mn2,u[i]); mx2=max(mx2,d[i]); } if (solve(f(v,mn,mn2),k-1)){ res.push_back({mn,mn2}); return true; } if (solve(f(v,mn,mx2),k-1)){ res.push_back({mn,mx2}); return true; } return false; } int main(){ ios_base::sync_with_stdio(NULL);cin.tie(nullptr); cin >> n >> k; for (int i=0;i<n;i++){ cin >> l[i] >> d[i] >> r[i] >> u[i]; v.push_back(i); } bool tmp=solve(v,k); for (auto [x,y]:res) cout << x << ' ' << y << '\n'; }

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

hamburg.cpp: In function 'int main()':
hamburg.cpp:45:10: warning: unused variable 'tmp' [-Wunused-variable]
   45 |     bool tmp=solve(v,k);
      |          ^~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...