Submission #798636

#TimeUsernameProblemLanguageResultExecution timeMemory
798636gg123_peStrange Device (APIO19_strange_device)C++14
10 / 100
894 ms53200 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define f(i,a,b) for(int i = a; i < b; i++) const int N = 1e6 + 5; int n; ll l[N], r[N]; ll A, B, S; void subtask_1(){ set <pair<ll,ll>> s; f(i,1,n+1){ for(ll j = l[i]; j <= r[i]; j++){ ll a, b; a = (j + j/B) % A; b = j % B; s.insert({a, b}); } } cout << s.size() << "\n"; } int main(){ cin >> n >> A >> B; f(i,1,n+1){ cin >> l[i] >> r[i]; S += r[i] - l[i] + 1; } if(S <= N){ subtask_1(); return 0; } 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...
#Verdict Execution timeMemoryGrader output
Fetching results...