Submission #572017

#TimeUsernameProblemLanguageResultExecution timeMemory
5720178e7Broken Device 2 (JOI22_device2)C++17
10 / 100
796 ms32580 KiB
//Challenge: Accepted #include "Anna.h" #include <bits/stdc++.h> using namespace std; namespace { #ifdef zisk void debug(){cout << endl;} template<class T, class ... U> void debug(T a, U ...b){cout << a << " ", debug(b...);} template<class T> void pary(T l, T r) { while (l != r) cout << *l << " ", l++; cout << endl; } #else #define debug(...) 0 #define pary(...) 0 #endif #define ll long long #define maxn 2005 #define pii pair<int, int> #define ff first #define ss second int sum[maxn]; } int Declare() { for (int i = 1;i < maxn;i++) { sum[i] = sum[i-1] + i * 2 + 1; } return 2000; } std::pair<std::vector<int>, std::vector<int> > Anna(long long A) { int len = 0; while (A > sum[len+1]) len++; vector<int> X(len+1, 0); vector<int> Y(len+1, 0); A--; for (int i = 0;i < min(len+1, int(A - sum[len]));i++) X[i] = 1; for (int i = 0;i < min(len+1, int(A - sum[len] - (len+1)));i++) Y[i] = 1; //pary(X.begin(), X.end()); //pary(Y.begin(), Y.end()); return make_pair(X, Y); }
//Challenge: Accepted #include "Bruno.h" #include <bits/stdc++.h> using namespace std; #ifdef zisk void debug(){cout << endl;} template<class T, class ... U> void debug(T a, U ...b){cout << a << " ", debug(b...);} template<class T> void pary(T l, T r) { while (l != r) cout << *l << " ", l++; cout << endl; } #else #define debug(...) 0 #define pary(...) 0 #endif #define ll long long #define maxn 2005 #define pii pair<int, int> #define ff first #define ss second namespace { bool ini = 0; int sum[maxn]; } long long Bruno(std::vector<int> u) { if (!ini) { ini = 1; for (int i = 1;i < maxn;i++) { sum[i] = sum[i-1] + i * 2 + 1; } } int len = u.size() / 2; int ret = sum[len-1]+1; for (int i = 0;i < 2*len;i++) { if (u[i] == 1) ret++; } return ret; }
#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...