Submission #741573

#TimeUsernameProblemLanguageResultExecution timeMemory
741573yeysoStrange Device (APIO19_strange_device)C++14
10 / 100
5054 ms524288 KiB
#include <bits/stdc++.h> using namespace std; int main(){ long long n, a, b; cin >> n >> a >> b; vector<pair<long long, long long>> periods; long long l, r; long long time = 0; for(long long i = 0; i < n; i ++){ cin >> l >> r; periods.push_back({l, r}); } time = periods[periods.size()-1].second; set<pair<long long, long long>> res; long long x, y; for(long long i = 0; i < n; i ++){ for(long long t = periods[i].first; t <= periods[i].second; t ++){ x = (t + (t/b)) % a; y = t % b; res.insert({x, y}); } } cout << res.size(); } /* g++ -std=gnu++17 -O2 -pipe -static -o device device.cpp 3 3 3 4 4 7 9 17 18 */

Compilation message (stderr)

strange_device.cpp: In function 'int main()':
strange_device.cpp:7:15: warning: variable 'time' set but not used [-Wunused-but-set-variable]
    7 |     long long time = 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...