답안 #154711

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
154711 2019-09-23T18:57:37 Z HBK_Wasi 이상한 기계 (APIO19_strange_device) C++14
35 / 100
2757 ms 53528 KB
#include<bits/stdc++.h>
#define lli long long int
#define int long long int
#define pii pair<int, int>
 
#ifdef LOCAL
#define debug(a) cout<<#a<<' '<<a<<endl;
#endif
 
#ifndef LOCAL
#define debug(a) ;
#endif
 
using namespace std;
void faster(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie();
	cout.tie();
}
 
 
int lcm(int a, int b)
{
	return (a*b)/__gcd(a,b);
} 
map<pii, bool> q; 
 
int32_t main()
{
	#ifdef LOCAL
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
 
	pii x;
	vector<pii> v;
	int i, n, A, B, l, r, mx;
	cin >> n >> A >> B;
	
	if(0==0)
	{
		int ln;
		mx = B*(A/__gcd(A, B+1));
		for(i=1;i<=n;i++)
		{
			cin >> l >> r;
			int ln = r-l;
			l = l % (mx);
			if(ln>=mx)
			{
 
				cout<<mx<<endl;
				exit(0);
			}
			if(l+ln >= mx)
			{
				v.push_back(pii(l, mx-1));
				v.push_back(pii(0, l+ln-mx));
			}
			else
			{
				v.push_back(pii(l, l+ln));
			}
		} 
		sort(v.begin(), v.end());
		int sum=0, right=-1;
		for(int i=0;i<v.size();i++)
		{
			if(v[i].first > right) sum += (v[i].second-v[i].first+1), right=v[i].second;
			else if(v[i].second > right) sum += (v[i].second-right), right=v[i].second;
		}
		cout<<sum<<endl;
		exit(0);
	}
	cout<<q.size()<<endl;
	return 0;	
}

Compilation message

strange_device.cpp: In function 'int32_t main()':
strange_device.cpp:68:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<v.size();i++)
               ~^~~~~~~~~
strange_device.cpp:43:7: warning: unused variable 'ln' [-Wunused-variable]
   int ln;
       ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 29 ms 1144 KB Output is correct
3 Correct 31 ms 1144 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 30 ms 1016 KB Output is correct
17 Correct 271 ms 5756 KB Output is correct
18 Incorrect 2 ms 376 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Incorrect 2 ms 256 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 1922 ms 41436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2647 ms 53420 KB Output is correct
3 Correct 2661 ms 53260 KB Output is correct
4 Correct 2654 ms 53528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2647 ms 53420 KB Output is correct
3 Correct 2661 ms 53260 KB Output is correct
4 Correct 2654 ms 53528 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2650 ms 53160 KB Output is correct
7 Correct 2670 ms 53320 KB Output is correct
8 Correct 2702 ms 53364 KB Output is correct
9 Correct 2720 ms 53384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2647 ms 53420 KB Output is correct
3 Correct 2661 ms 53260 KB Output is correct
4 Correct 2654 ms 53528 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 265 ms 5768 KB Output is correct
7 Correct 269 ms 5732 KB Output is correct
8 Correct 321 ms 5892 KB Output is correct
9 Correct 268 ms 5736 KB Output is correct
10 Correct 267 ms 5780 KB Output is correct
11 Correct 270 ms 5732 KB Output is correct
12 Correct 265 ms 5712 KB Output is correct
13 Correct 270 ms 5748 KB Output is correct
14 Correct 263 ms 5732 KB Output is correct
15 Correct 270 ms 5732 KB Output is correct
16 Correct 272 ms 5752 KB Output is correct
17 Correct 267 ms 5724 KB Output is correct
18 Correct 2716 ms 53224 KB Output is correct
19 Correct 2641 ms 53384 KB Output is correct
20 Correct 2705 ms 53056 KB Output is correct
21 Correct 269 ms 5676 KB Output is correct
22 Correct 263 ms 5860 KB Output is correct
23 Correct 885 ms 18652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 271 ms 5820 KB Output is correct
3 Correct 272 ms 5912 KB Output is correct
4 Correct 2725 ms 53200 KB Output is correct
5 Correct 269 ms 5704 KB Output is correct
6 Correct 270 ms 5700 KB Output is correct
7 Correct 275 ms 5732 KB Output is correct
8 Correct 271 ms 5816 KB Output is correct
9 Correct 269 ms 5736 KB Output is correct
10 Correct 275 ms 5732 KB Output is correct
11 Correct 271 ms 5732 KB Output is correct
12 Correct 267 ms 5804 KB Output is correct
13 Correct 274 ms 5844 KB Output is correct
14 Correct 2757 ms 53408 KB Output is correct
15 Correct 265 ms 5860 KB Output is correct
16 Correct 2676 ms 53284 KB Output is correct
17 Correct 2646 ms 53280 KB Output is correct
18 Incorrect 2 ms 252 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 29 ms 1144 KB Output is correct
3 Correct 31 ms 1144 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 30 ms 1016 KB Output is correct
17 Correct 271 ms 5756 KB Output is correct
18 Incorrect 2 ms 376 KB Output isn't correct