Submission #619639

#TimeUsernameProblemLanguageResultExecution timeMemory
619639AriaHComparing Plants (IOI20_plants)C++17
5 / 100
88 ms7912 KiB
#include "plants.h" /* I can do this all day */ #pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair < int, int > pii; typedef pair < ll, ll > pll; #define F first #define S second #define all(x) x.begin(),x.end() #define Mp make_pair #define point complex #define endl '\n' #define SZ(x) (int)x.size() #define fast_io ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define file_io freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout); const int N = 1e6 + 10; const int LOG = 20; const ll mod = 1e9 + 7; const ll inf = 8e18; const double pi = acos(-1); const ld eps = 1e-18; const ld one = 1.; ll pw(ll a, ll b, ll M, ll ret = 1) { if(a == 0) return 0; a %= M; while(b) { ret = (b & 1? ret * a % M : ret), a = a * a % M, b >>= 1; } return ret % M; } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int n, ps[N]; void init(int k, vector < int > r) { n = SZ(r); for(int i = 1; i <= n; i ++) { ps[i] = ps[i - 1] + (1 - r[i - 1]); ///printf("i = %d ps = %d\n", i, ps[i]); } return; } int compare_plants(int x, int y) { int z = 1; x ++; y ++; if(x > y) { swap(x, y); z = -1; } if(ps[y - 1] - ps[x - 1] == 0) { return -1 * z; } if(ps[y - 1] - ps[x - 1] == y - x) { return 1 * z; } if(ps[n] - ps[y - 1] + ps[x - 1] == 0) { return 1 * z; } if(ps[n] - ps[y - 1] + ps[x - 1] == n - y + x) { return -1 * z; } /*printf("n = %d x = %d y = %d\n",n, x, y); printf("x = %d y = %d n - y + x = %d\n", x, y, n - y + x); */ return 0; }
#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...