Submission #389467

#TimeUsernameProblemLanguageResultExecution timeMemory
389467balbitBinary Subsequences (info1cup17_binary)C++14
12.90 / 100
707 ms312 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast", "unroll-loops") //#ifndef BALBIT //#include "grader.h" //#endif using namespace std; #define ll long long #define pii pair<int, int> #define f first #define s second #define REP(i,n) for (int i = 0; i<n; ++i) #define REP1(i,n) for (int i = 1; i<=n; ++i) #define SZ(x) (int)((x).size()) #define ALL(x) (x).begin(), (x).end() #define pb push_back #ifdef BALBIT #define bug(...) cerr<<"#"<<__LINE__<<": "<<#__VA_ARGS__<<"- ", _do(__VA_ARGS__) template<typename T> void _do(T && x) {cerr<<x<<endl;} template<typename T, typename ...S> void _do(T && x, S && ...y) {cerr<<x<<", "; _do(y...);} #else #define bug(...) #define endl '\n' #endif // BALBITs bool yes(int a, int b) { if (a==b) return a==0; if (a < b) swap(a,b); a %= (b+1); return yes(a,b); } signed main(){ ios::sync_with_stdio(0), cin.tie(0); int t; cin>>t; while (t--) { int n; cin>>n; int re = 0; for (int i = 0; i<=n; ++i) { if (yes(i, n-i)) ++re; } cout<<re<<endl; cout<<-1<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...