답안 #1031795

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1031795 2024-07-23T07:20:50 Z KasymK 이상한 기계 (APIO19_strange_device) C++17
10 / 100
5000 ms 524288 KB
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int MOD = 1e9+7;
const int N = 1e5+5;

int main(){
	// freopen("file.txt", "r", stdin);
	int n, a, b;
	set<pair<ll, ll>> s;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1; i <= n; ++i){
		ll l, r;
		scanf("%lld%lld", &l, &r);
		for(ll t = l; t <= r; ++t){
			ll x = (t+t/b)%a, y = t%b;
			s.insert({x, y});
		}
	}
	int answer = (int)s.size();
	printf("%d\n", answer);
	return 0;
}

Compilation message

strange_device.cpp: In function 'int main()':
strange_device.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |  scanf("%d%d%d", &n, &a, &b);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
strange_device.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |   scanf("%lld%lld", &l, &r);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 37 ms 12368 KB Output is correct
3 Correct 41 ms 18308 KB Output is correct
4 Correct 1 ms 856 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 5 ms 1116 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 23 ms 6988 KB Output is correct
16 Correct 19 ms 7252 KB Output is correct
17 Correct 41 ms 10244 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 1745 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 87 ms 32172 KB Output is correct
3 Correct 86 ms 32208 KB Output is correct
4 Correct 72 ms 30544 KB Output is correct
5 Execution timed out 5054 ms 62548 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 389 ms 62988 KB Output is correct
3 Runtime error 1280 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 389 ms 62988 KB Output is correct
3 Runtime error 1280 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 389 ms 62988 KB Output is correct
3 Runtime error 1280 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 910 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 37 ms 12368 KB Output is correct
3 Correct 41 ms 18308 KB Output is correct
4 Correct 1 ms 856 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 5 ms 1116 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 23 ms 6988 KB Output is correct
16 Correct 19 ms 7252 KB Output is correct
17 Correct 41 ms 10244 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Runtime error 1745 ms 524288 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -