답안 #373777

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
373777 2021-03-05T18:14:10 Z Nimbostratus Vepar (COCI21_vepar) C++17
0 / 70
1500 ms 21568 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define clean(a,s) memset((a),0,sizeof((a)[0])*(s))
#define all(x) (x).begin() , (x).end()
#define fi first
#define se second
#define int int
using pii = pair<int,int>;
using ll = long long;
const int maxn = 1e7+5;
const int inf = 2e9;
const int mod = 1e9+7;

int t,a,b,c,d;
int psz,prime[maxn],cnt_a[maxn],cnt_c[maxn];
bitset<maxn> composite;

int32_t main () {
	//freopen("in","r",stdin); freopen("out","w",stdout);
	ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	for(int i=2;i<maxn;i++) {
		if(composite[i]) continue;
		prime[++psz] = i;
		for(ll j=1ll*i*i;j<1ll*maxn;j+=i)
			composite[j] = true;
	}
	cin >> t;
	while(t--) {
		cin >> a >> b >> c >> d;
		for(int i=c;i<=d;i++) {
			int tmp = i;
			for(int j=1;j<=psz && 1ll*prime[j]*prime[j] <= tmp;j++) {
				if(tmp % prime[j]) continue;
				int cur = prime[j];
				while(tmp > 0 && tmp % cur == 0) {
					tmp /= cur;
					cnt_c[cur]++;
				}
			}
			if(tmp > 0) cnt_c[tmp]++;
		}
		for(int i=a;i<=b;i++) {
			int tmp = i;
			for(int j=1;j<=psz && 1ll*prime[j]*prime[j] <= tmp;j++) {
				if(tmp % prime[j]) continue;
				int cur = prime[j];
				while(tmp > 0 && tmp % cur == 0) {
					tmp /= cur;
					cnt_a[cur]++;
				}
			}
			if(tmp > 0) cnt_a[tmp]++;
		}
		bool f = true; 
		for(int i=1;i<=maxn;i++)
			if(cnt_a[i] > cnt_c[i]) {
				f = false;
				break;
			}
		cout << (f ? "DA" : "NE") << endl;	
	}
}	
	


# 결과 실행 시간 메모리 Grader output
1 Incorrect 54 ms 4204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 54 ms 4204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 54 ms 4204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1528 ms 17916 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1537 ms 21332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1536 ms 21244 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1554 ms 21568 KB Time limit exceeded
2 Halted 0 ms 0 KB -