#include <bits/stdc++.h> #include "dzilib.h" using namespace std; int main(){ long long n, t, q, c; n = GetN(); t = GetT(); q = GetQ(); c = GetC(); vector <int> divisors(1'010'000); for(int i = 1; i<=1'000'000; ++i){ for(int j = i; j<1'010'000; j+=i){ divisors[j]++; } } int tpom = t; while(t--){ int s = q/tpom; vector <int> next(s); for(int i = 0; i<s; ++i) next[i] = Ask(i); for(int i = 1; i<=n; ++i){ bool notok = false; for(int j = 0; j<s; ++j){ if(next[j] != divisors[i+j]){ notok = true; break; } } if(notok) continue; Answer(i); break; } } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #include <bits/stdc++.h> #include "dzilib.h" using namespace std; int main(){ long long n, t, q, c; n = GetN(); t = GetT(); q = GetQ(); c = GetC(); vector <int> divisors(1'010'000); for(int i = 1; i<=1'000'000; ++i){ for(int j = i; j<1'010'000; j+=i){ divisors[j]++; } } int tpom = t; while(t--){ int s = q/tpom; vector <int> next(s); for(int i = 0; i<s; ++i) next[i] = Ask(i); for(int i = 1; i<=n; ++i){ bool notok = false; for(int j = 0; j<s; ++j){ if(next[j] != divisors[i+j]){ notok = true; break; } } if(notok) continue; Answer(i); break; } } } |