답안 #152823

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152823 2019-09-09T17:13:53 Z HBK_Wasi 이상한 기계 (APIO19_strange_device) C++14
35 / 100
2724 ms 18636 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*(lcm(A, B+1)/(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;
		//debug(lmin);
		//debug(rmax);
		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 1020 KB Output is correct
3 Correct 29 ms 1016 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 252 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 28 ms 1024 KB Output is correct
17 Correct 273 ms 3968 KB Output is correct
18 Incorrect 2 ms 256 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 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 256 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 1870 ms 18392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 356 KB Output is correct
2 Correct 2628 ms 18636 KB Output is correct
3 Correct 2623 ms 18092 KB Output is correct
4 Correct 2627 ms 16860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 356 KB Output is correct
2 Correct 2628 ms 18636 KB Output is correct
3 Correct 2623 ms 18092 KB Output is correct
4 Correct 2627 ms 16860 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 2636 ms 17176 KB Output is correct
7 Correct 2640 ms 17584 KB Output is correct
8 Correct 2646 ms 17468 KB Output is correct
9 Correct 2680 ms 17576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 356 KB Output is correct
2 Correct 2628 ms 18636 KB Output is correct
3 Correct 2623 ms 18092 KB Output is correct
4 Correct 2627 ms 16860 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 262 ms 3192 KB Output is correct
7 Correct 292 ms 3176 KB Output is correct
8 Correct 263 ms 3208 KB Output is correct
9 Correct 267 ms 3532 KB Output is correct
10 Correct 262 ms 3508 KB Output is correct
11 Correct 266 ms 3552 KB Output is correct
12 Correct 265 ms 3668 KB Output is correct
13 Correct 271 ms 3564 KB Output is correct
14 Correct 270 ms 3680 KB Output is correct
15 Correct 272 ms 3584 KB Output is correct
16 Correct 269 ms 3564 KB Output is correct
17 Correct 265 ms 3536 KB Output is correct
18 Correct 2634 ms 18308 KB Output is correct
19 Correct 2681 ms 18564 KB Output is correct
20 Correct 2688 ms 16864 KB Output is correct
21 Correct 268 ms 2496 KB Output is correct
22 Correct 288 ms 2616 KB Output is correct
23 Correct 884 ms 8924 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 267 ms 2568 KB Output is correct
3 Correct 270 ms 2540 KB Output is correct
4 Correct 2724 ms 16980 KB Output is correct
5 Correct 267 ms 3176 KB Output is correct
6 Correct 271 ms 3192 KB Output is correct
7 Correct 284 ms 3292 KB Output is correct
8 Correct 279 ms 3144 KB Output is correct
9 Correct 269 ms 3208 KB Output is correct
10 Correct 270 ms 3092 KB Output is correct
11 Correct 331 ms 2864 KB Output is correct
12 Correct 267 ms 2952 KB Output is correct
13 Correct 269 ms 2884 KB Output is correct
14 Correct 2677 ms 17216 KB Output is correct
15 Correct 269 ms 3700 KB Output is correct
16 Correct 2625 ms 17940 KB Output is correct
17 Correct 2619 ms 18024 KB Output is correct
18 Incorrect 2 ms 256 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 29 ms 1020 KB Output is correct
3 Correct 29 ms 1016 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 252 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 28 ms 1024 KB Output is correct
17 Correct 273 ms 3968 KB Output is correct
18 Incorrect 2 ms 256 KB Output isn't correct