제출 #833097

#제출 시각아이디문제언어결과실행 시간메모리
833097maomao90Monster Game (JOI21_monster)C++17
0 / 100
51 ms288 KiB
// Hallelujah, praise the one who set me free // Hallelujah, death has lost its grip on me // You have broken every chain, There's salvation in your name // Jesus Christ, my living hope #include <bits/stdc++.h> #include "monster.h" using namespace std; #define REP(i, s, e) for (int i = (s); i < (e); i++) #define RREP(i, s, e) for (int i = (s); i >= (e); i--) template <class T> inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;} template <class T> inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;} typedef unsigned long long ull; typedef long long ll; typedef long double ld; #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; typedef tuple<int, int, int> iii; #define ALL(_a) _a.begin(), _a.end() #define SZ(_a) (int) _a.size() #define pb push_back typedef vector<int> vi; typedef vector<ll> vll; typedef vector<ii> vii; typedef vector<iii> viii; #ifndef DEBUG #define cerr if (0) cerr #endif const int INF = 1000000005; const ll LINF = 1000000000000000005ll; const int MAXN = 1005; namespace { int n; vi p; int tmp[MAXN]; void dnc(int l, int r) { if (l == r) { return; } int m = l + r >> 1; dnc(l, m); dnc(m + 1, r); int pl = l, pr = m + 1; int ptr = l; while (pl <= m || pr <= r) { if (pr > r || (pl <= m && !Query(p[pl], p[pr]))) { tmp[ptr++] = p[pl++]; } else { tmp[ptr++] = p[pr++]; } } REP (i, l, r + 1) { p[i] = tmp[i]; } } } vi Solve(int N) { n = N; p = vi(n); iota(ALL(p), 0); dnc(0, n - 1); REP (i, 0, n) { cerr << p[i] << ' '; } cerr << '\n'; REP (i, 0, n - 1) { if (Query(p[i], p[i + 1])) { continue; } if (i == 0) { if (!Query(p[1], p[3]) && !Query(p[1], p[4])) { swap(p[0], p[1]); continue; } } swap(p[i + 1], p[i + 2]); i++; } REP (i, 0, n) { cerr << p[i] << ' '; } cerr << '\n'; vi t(n); REP (i, 0, n) { t[p[i]] = i; } return t; }

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

monster.cpp: In function 'void {anonymous}::dnc(int, int)':
monster.cpp:50:19: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   50 |         int m = l + r >> 1;
      |                 ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...