답안 #409672

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
409672 2021-05-21T10:44:24 Z Batorgil952 이상한 기계 (APIO19_strange_device) C++14
10 / 100
5000 ms 524292 KB
#include<bits/stdc++.h>
#define mp make_pair

using namespace std;

map< pair< int, int >, int > M;

int main(){
	long long n, q, p, i, j, x, y, a, b, s;
	
	scanf("%lld",&n);
	scanf("%lld",&q);
	scanf("%lld",&p);
	
	s=0;
	for(i=1; i<=n; i++){
		scanf("%lld",&x);
		scanf("%lld",&y);
		for(j=x; j<=y; j++){
			a=(j+j/p)%q;
			b=j%p;
			M[mp(a, b)]++;
			if(M[mp(a, b)]==1) s++;
		}
	}
	
	cout<<s<<endl;
	
	return 0;
}

Compilation message

strange_device.cpp: In function 'int main()':
strange_device.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%lld",&n);
      |  ~~~~~^~~~~~~~~~~
strange_device.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%lld",&q);
      |  ~~~~~^~~~~~~~~~~
strange_device.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%lld",&p);
      |  ~~~~~^~~~~~~~~~~
strange_device.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   scanf("%lld",&x);
      |   ~~~~~^~~~~~~~~~~
strange_device.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   scanf("%lld",&y);
      |   ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 67 ms 12288 KB Output is correct
3 Correct 106 ms 17864 KB Output is correct
4 Correct 3 ms 844 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 460 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 13 ms 1080 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 65 ms 6980 KB Output is correct
16 Correct 41 ms 6596 KB Output is correct
17 Correct 83 ms 6592 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Runtime error 4302 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 209 ms 32220 KB Output is correct
3 Correct 242 ms 32004 KB Output is correct
4 Correct 189 ms 30532 KB Output is correct
5 Execution timed out 5068 ms 62428 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 739 ms 62924 KB Output is correct
3 Runtime error 3346 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 739 ms 62924 KB Output is correct
3 Runtime error 3346 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 739 ms 62924 KB Output is correct
3 Runtime error 3346 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Runtime error 2429 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 67 ms 12288 KB Output is correct
3 Correct 106 ms 17864 KB Output is correct
4 Correct 3 ms 844 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 460 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 13 ms 1080 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 65 ms 6980 KB Output is correct
16 Correct 41 ms 6596 KB Output is correct
17 Correct 83 ms 6592 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Runtime error 4302 ms 524292 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -