Submission #335090

# Submission time Handle Problem Language Result Execution time Memory
335090 2020-12-11T06:19:04 Z nicholask Strange Device (APIO19_strange_device) C++14
10 / 100
5000 ms 524292 KB
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
using namespace std;
signed main(){
	int n,a,b;
	cin>>n>>a>>b;
	pair <int,int> p[n];
	for (int i=0; i<n; i++) cin>>p[i].x>>p[i].y;
	if (n==1){
		__int128 f=p[0].y-p[0].x+1;
		__int128 s=p[0].x*p[0].y/__gcd(p[0].y,(p[0].y+1)%p[0].x);
		int op=min(f,s);
		cout<<op;
	} else {
		set <pair <int,int> > s;
		for (int i=0; i<n; i++){
			for (int t=p[i].x; t<=p[i].y; t++) s.insert({(t+t/b)%a,t%b});
		}
		cout<<s.size();
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 62 ms 12832 KB Output is correct
3 Correct 84 ms 18540 KB Output is correct
4 Correct 2 ms 876 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 2 ms 492 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 8 ms 1260 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 44 ms 7040 KB Output is correct
16 Correct 41 ms 7276 KB Output is correct
17 Correct 172 ms 11244 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Runtime error 1 ms 508 KB Execution killed with signal 8 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 149 ms 32364 KB Output is correct
3 Correct 174 ms 32236 KB Output is correct
4 Correct 135 ms 30600 KB Output is correct
5 Execution timed out 5073 ms 103424 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1621 ms 78640 KB Output is correct
3 Runtime error 3532 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1621 ms 78640 KB Output is correct
3 Runtime error 3532 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1621 ms 78640 KB Output is correct
3 Runtime error 3532 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Runtime error 1890 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 1 ms 364 KB Output is correct
2 Correct 62 ms 12832 KB Output is correct
3 Correct 84 ms 18540 KB Output is correct
4 Correct 2 ms 876 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 2 ms 492 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 8 ms 1260 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 44 ms 7040 KB Output is correct
16 Correct 41 ms 7276 KB Output is correct
17 Correct 172 ms 11244 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 0 ms 364 KB Output is correct
20 Runtime error 1 ms 508 KB Execution killed with signal 8 (could be triggered by violating memory limits)
21 Halted 0 ms 0 KB -