Submission #198254

# Submission time Handle Problem Language Result Execution time Memory
198254 2020-01-25T08:56:08 Z AMO5 Strange Device (APIO19_strange_device) C++
10 / 100
5000 ms 524292 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair < ll ,ll> pll; 

ll n,a,b;
map < pll , ll >vis;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n >> a >> b;
	ll le,ri, ans = 0;
	
	for(ll i = 0; i < n; i++){
		cin >> le >> ri;
		for(ll j = le; j <= ri; j++){
			ll t = j;
			ll x = (t+(t/b))%a;
			ll y = t%b;
			if(!vis[{x,y}]){
				ans++;
			}
			vis[{x,y}]++;
		}
	}
	cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 98 ms 12920 KB Output is correct
3 Correct 149 ms 18296 KB Output is correct
4 Correct 5 ms 888 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 3 ms 632 KB Output is correct
9 Correct 17 ms 1272 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 296 KB Output is correct
13 Correct 2 ms 380 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 89 ms 7132 KB Output is correct
16 Correct 59 ms 7288 KB Output is correct
17 Correct 113 ms 10360 KB Output is correct
18 Correct 2 ms 436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Execution timed out 5069 ms 331872 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 268 ms 32352 KB Output is correct
3 Correct 290 ms 32248 KB Output is correct
4 Correct 273 ms 30720 KB Output is correct
5 Execution timed out 5099 ms 62568 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 935 ms 63888 KB Output is correct
3 Execution timed out 5060 ms 515248 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 935 ms 63888 KB Output is correct
3 Execution timed out 5060 ms 515248 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 935 ms 63888 KB Output is correct
3 Execution timed out 5060 ms 515248 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Runtime error 2950 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 98 ms 12920 KB Output is correct
3 Correct 149 ms 18296 KB Output is correct
4 Correct 5 ms 888 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 3 ms 632 KB Output is correct
9 Correct 17 ms 1272 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 296 KB Output is correct
13 Correct 2 ms 380 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 89 ms 7132 KB Output is correct
16 Correct 59 ms 7288 KB Output is correct
17 Correct 113 ms 10360 KB Output is correct
18 Correct 2 ms 436 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Execution timed out 5069 ms 331872 KB Time limit exceeded
21 Halted 0 ms 0 KB -