# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
824102 | 2023-08-13T13:54:41 Z | thimote75 | 식물 비교 (IOI20_plants) | C++14 | 4000 ms | 8636 KB |
#include "plants.h" #include <bits/stdc++.h> using namespace std; using idata = vector<int>; template<typename A, typename B> string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template<typename T> string to_string (T x) { string S = "["; bool first = true; for (const auto v : x) { if (!first) S += ", "; S += to_string(v); first = false; } S += "]"; return S; } string to_string( string s) { return s; } string to_string(bool b) { return to_string((int) b); } void dbg_out () { cout << endl; } template<typename Head, typename... Tail> void dbg_out (Head H, Tail... T) { cout << to_string(H) << " "; dbg_out(T...); } #ifdef DEBUG # define dbg(...) { cout << "(" << #__VA_ARGS__ << "): "; dbg_out(__VA_ARGS__); } #else # define dbg(...) #endif void shift (idata &r, int count) { idata h; for (int i = count; i < r.size(); i ++) h.push_back(r[i]); for (int i = 0; i < count; i ++) h.push_back(r[i]); r.swap(h); } idata A; void init(int k, idata r) { idata r0 = r; int n = r.size(); A.resize(n); int s = 0; for (int v = n - 1; v >= 0; v --) { int p = -1; int l = -1; for (int i = 0; i < n; i ++) if (r[i] == 0) l = i; assert(l != -1); l -= n; dbg(l, v, r) for (int i = 0; i < n; i ++) { if (r[i] != 0) continue ; int d = i - l; l = i; if (d < k) continue ; p = i; break ; } dbg(p); r[p] = 1e9; for (int g = p - 1; g > p - k; g --) { int u = (g + n) % n; if (r[u] != 0) r[u] --; } A[p] = v; } idata h(n); for (int i = 0; i < n; i ++) { int u = 0; for (int j = i + 1; j < i + k; j ++) if (A[j % n] > A[i]) u ++; h[i] = u; } //for (int u : h) cout << u << " "; cout << endl; //for (int u : A) cout << u << " "; cout << endl; return; } int compare_plants(int x, int y) { int del = A[x] - A[y]; if (del == 0) return 0; return del / abs(del); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 1 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 10 ms | 372 KB | Output is correct |
7 | Correct | 269 ms | 3240 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 10 ms | 364 KB | Output is correct |
10 | Correct | 261 ms | 3120 KB | Output is correct |
11 | Correct | 170 ms | 3088 KB | Output is correct |
12 | Correct | 173 ms | 3320 KB | Output is correct |
13 | Correct | 322 ms | 3184 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 10 ms | 372 KB | Output is correct |
7 | Correct | 269 ms | 3240 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 10 ms | 364 KB | Output is correct |
10 | Correct | 261 ms | 3120 KB | Output is correct |
11 | Correct | 170 ms | 3088 KB | Output is correct |
12 | Correct | 173 ms | 3320 KB | Output is correct |
13 | Correct | 322 ms | 3184 KB | Output is correct |
14 | Correct | 2553 ms | 3420 KB | Output is correct |
15 | Execution timed out | 4081 ms | 5728 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 52 ms | 3924 KB | Output is correct |
4 | Execution timed out | 4064 ms | 8636 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 1 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |