제출 #599716

#제출 시각아이디문제언어결과실행 시간메모리
599716skittles1412자리 배치 (IOI18_seats)C++17
11 / 100
4088 ms40780 KiB
#include "bits/extc++.h" using namespace std; template <typename T> void dbgh(const T& t) { cerr << t << endl; } template <typename T, typename... U> void dbgh(const T& t, const U&... u) { cerr << t << " | "; dbgh(u...); } #ifdef DEBUG #define dbg(...) \ cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \ dbgh(__VA_ARGS__); #else #define dbg(...) #define cerr \ if (false) \ cerr #endif #define endl "\n" #define long int64_t #define sz(x) int((x).size()) int n, m; vector<int> r, c; void give_initial_chart(int _n, int _m, vector<int> _r, vector<int> _c) { n = _n; m = _m; r = _r; c = _c; } int swap_seats(int a, int b) { swap(r[a], r[b]); swap(c[a], c[b]); int ans = 0, mnr = r[0], mxr = r[0], mnc = c[0], mxc = c[0]; for (int i = 0; i < n * m; i++) { mnr = min(mnr, r[i]); mxr = max(mxr, r[i]); mnc = min(mnc, c[i]); mxc = max(mxc, c[i]); ans += i + 1 == (mxr - mnr + 1) * (mxc - mnc + 1); } return ans; }
#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...