제출 #211510

#제출 시각아이디문제언어결과실행 시간메모리
211510dimash241함박 스테이크 (JOI20_hamburg)C++17
21 / 100
3047 ms6224 KiB
//#pragma GCC target("avx2") //#pragma GCC optimize("O3") //# include <x86intrin.h> # include <bits/stdc++.h> //# include <ext/pb_ds/assoc_container.hpp> //# include <ext/pb_ds/tree_policy.hpp> //using namespace __gnu_pbds; using namespace std; //template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define _USE_MATH_DEFINES_ #define ll long long #define ld long double #define Accepted 0 #define pb push_back #define mp make_pair #define sz(x) (int)(x.size()) #define every(x) x.begin(),x.end() #define F first #define S second #define lb lower_bound #define ub upper_bound #define For(i,x,y) for (ll i = x; i <= y; i ++) #define FOr(i,x,y) for (ll i = x; i >= y; i --) #define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) // ROAD to... Red inline void Input_Output () { //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); } const double eps = 0.000001; const ld pi = acos(-1); const int maxn = 1e7 + 9; const int mod = 1e9 + 7; const ll MOD = 1e18 + 9; const ll INF = 1e18 + 123; const int inf = 2e9 + 11; const int mxn = 1e6 + 9; const int N = 2e5 + 123; const int M = 22; const int pri = 997; const int Magic = 2101; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1}; int n, m, k; int ax[N], bx[N], ay[N], by[N]; int p[N]; int ord[5]; int mxL[5]; int mnR[5]; int mxU[5]; int mnD[5]; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); inline void chmx (int &a, int b) { if (a < b) a = b; } inline void chmn (int &a, int b) { if (a > b) a = b; } inline void solve () { for (int i = 1; i <= k; ++i) { mxL[i] = mxU[i] = 1; mnR[i] = mnD[i] = 1e9; } vector < int > bad, aa; for (int ii = 1, i; ii <= n; ++ii) { i = p[ii]; bool ff = 0; for (int j = 1; j <= k; ++j) { int L = mxL[j]; int U = mxU[j]; int D = mnD[j]; int R = mnR[j]; chmx(L, ax[i]); chmx(U, bx[i]); chmn(R, ay[i]); chmn(D, by[i]); if (L > R) continue; if (U > D) continue; ff = 1; mxL[j] = L; mnR[j] = R; mnD[j] = D; mxU[j] = U; break; } if(!ff) bad.pb(i); else aa.pb(i); } if (bad.empty()) { for (int j = 1; j <= k; ++j) { cout << mxL[j] << ' ' << mxU[j] << '\n'; } exit(0); } shuffle(every(bad), rng); for (int i = 1; i <= n; i ++) { if (i > sz(bad)) p[i] = aa[i-sz(bad) - 1]; else p[i] = bad[i-1]; } } int main () { scanf("%d%d", &n, &k); for (int i = 1; i <= n; ++i) { scanf("%d%d%d%d", &ax[i], &bx[i], &ay[i], &by[i]); p[i] = i; } while (true) solve(); return Accepted; } // First :D

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

hamburg.cpp: In function 'int main()':
hamburg.cpp:117:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  117 |  scanf("%d%d", &n, &k);
      |  ~~~~~^~~~~~~~~~~~~~~~
hamburg.cpp:119:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  119 |   scanf("%d%d%d%d", &ax[i], &bx[i], &ay[i], &by[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...