답안 #86393

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
86393 2018-11-26T08:54:23 Z MaHaMBa_25 Savrsen (COCI17_savrsen) C++14
30 / 120
3000 ms 532 KB
#include <bits/stdc++.h>
#define GLHF ios_base::sync_with_stdio(0); cin.tie(), cout.tie();
#define GGWP return 0;
#define ALTF4 exit(0)
#define GCWS/*Good Contest, Well Solved*/ ALTF4
#define ull unsigned long long
#define ll long long
#define ld long double
#define fxr1(x) for(int I = 0; I < x; ++I)
#define fxr(x) for(int I = 0; I <= x; ++I)
#define F first
#define S second

using namespace std;

ll a, b, ans;
vector <int> v;

int res( int a )
{
	for ( int I = 2; I <= a/2; ++I )
		if ( a % I == 0 )
		{
			v.push_back(I);
			for ( int J = I + 1; J <= a/2; ++J )
				if ( a % J == 0 )
					v.push_back(J);
			return false;
		}
	return true;
}

int main()
{
	GLHF
	cin >> a >> b;
	for ( ll I = a; I <= b; ++I )
	{
		ll cnt = I;
		if ( res(I) == false )
		{
			for ( int I = 0; I < v.size(); ++I )
				cnt -= v[I];
			v.clear();
		}
		if ( I != 1 )
			cnt -= 1;
		ans += abs(cnt);
	}
	cout << ans << endl;
	GGWP
}

//clang++ -v -std=c++11 finish fishing the fish.people

Compilation message

savrsen.cpp: In function 'int main()':
savrsen.cpp:42:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for ( int I = 0; I < v.size(); ++I )
                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Execution timed out 3041 ms 392 KB Time limit exceeded
4 Execution timed out 3045 ms 468 KB Time limit exceeded
5 Execution timed out 3061 ms 484 KB Time limit exceeded
6 Execution timed out 3041 ms 484 KB Time limit exceeded
7 Execution timed out 3029 ms 532 KB Time limit exceeded
8 Execution timed out 3032 ms 532 KB Time limit exceeded