# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
824094 | 2023-08-13T13:48:07 Z | thimote75 | Comparing Plants (IOI20_plants) | C++14 | 1 ms | 212 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |