Submission #551433

#TimeUsernameProblemLanguageResultExecution timeMemory
551433BalintRBroken Device 2 (JOI22_device2)C++17
5 / 100
566 ms22324 KiB
#include <bits/stdc++.h> using namespace std; #include "Anna.h" namespace { typedef unsigned uint; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<pii> vpii; typedef complex<double> cmplx; template <typename T> using minPq = priority_queue<T, vector<T>, greater<T>>; #define boost() cin.sync_with_stdio(0); cin.tie(0) #define ms(a, x) memset(a, x, sizeof(a)) #define pb push_back #define fs first #define sn second #define ALL(v) (v).begin(), (v).end() #define SZ(v) ((int) (v).size()) #define lbv(v, x) (lower_bound((v).begin(), (v).end(), x) - (v).begin()) #define ubv(v, x) (upper_bound((v).begin(), (v).end(), x) - (v).begin()) template <typename T> inline void UNIQUE(vector<T> &v){sort(ALL(v)); v.resize(unique(ALL(v)) - v.begin());} const int INF = 0x3f3f3f3f; const ll LLINF = 0x3f3f3f3f3f3f3f3f; const double PI = acos(-1); #define FR(i, n) for(int i = 0; i < (n); i++) #define FOR(i, a, b) for(int i = (a); i < (b); i++) #define FORR(i, a, b) for(int i = (a); i >= (b); i--) #define dbg(x) {cout << #x << ' ' << x << endl;} #define dbgArr(arr, n) {cout << #arr; FR(_i, n) cout << ' ' << arr[_i]; cout << endl;} const int MX = 3.9e6; const int MN = 2000; } int Declare(){ return MN; } pair<vi, vi> Anna(ll input){ ll x = input % MX; input /= MX; int len = 4, pop = -1; while(len < MN){ int dif = len*2 - 7; if(x < dif){ pop = 4 + x; break; } x -= dif; len++; } vi res1(len), res2(len); if(input & 1) res1[0] = res2[0] = 1, pop--; if(input & 2) res1.back() = res2.back() = 1, pop--; FOR(i, 1, len-1) if(pop) res1[i] = 1, pop--; FOR(i, 1, len-1) if(pop) res2[i] = 1, pop--; return {res1, res2}; }
#include <bits/stdc++.h> using namespace std; #include "Bruno.h" namespace { typedef unsigned uint; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<pii> vpii; typedef complex<double> cmplx; template <typename T> using minPq = priority_queue<T, vector<T>, greater<T>>; #define boost() cin.sync_with_stdio(0); cin.tie(0) #define ms(a, x) memset(a, x, sizeof(a)) #define pb push_back #define fs first #define sn second #define ALL(v) (v).begin(), (v).end() #define SZ(v) ((int) (v).size()) #define lbv(v, x) (lower_bound((v).begin(), (v).end(), x) - (v).begin()) #define ubv(v, x) (upper_bound((v).begin(), (v).end(), x) - (v).begin()) template <typename T> inline void UNIQUE(vector<T> &v){sort(ALL(v)); v.resize(unique(ALL(v)) - v.begin());} const int INF = 0x3f3f3f3f; const ll LLINF = 0x3f3f3f3f3f3f3f3f; const double PI = acos(-1); #define FR(i, n) for(int i = 0; i < (n); i++) #define FOR(i, a, b) for(int i = (a); i < (b); i++) #define FORR(i, a, b) for(int i = (a); i >= (b); i--) #define dbg(x) {cout << #x << ' ' << x << endl;} #define dbgArr(arr, n) {cout << #arr; FR(_i, n) cout << ' ' << arr[_i]; cout << endl;} const int MX = 3.9e6; const int MN = 2000; } ll Bruno(vi u){ int len = 4; ll cnt = 0; while(len < SZ(u)/2){ int dif = len*2 - 7; cnt += dif; len++; } int pop = 0; for(int a : u) pop += a; cnt += pop-4; ll res = cnt; if(u.front()) res += MX * 2; if(u.back()) res += MX; cerr << res << endl; return res; }
#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...