# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
480277 | Jarif_Rahman | Vepar (COCI21_vepar) | C++17 | 263 ms | 9600 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
const int lim = 1e7+1;
vector<bool> prm(lim, 1);
vector<int> pp;
vector<ll> cnt;
void solve(){
int a, b, c, d;
cin >> a >> b >> c >> d;
a--, c--;
for(int i = 0; i < pp.size(); i++){
ll ss = pp[i];
while(ss <= b){
ll x = b/ss, y = a/ss;
cnt[i] += x-y;
ss*=pp[i];
}
}
for(int i = 0; i < pp.size(); i++){
ll ss = pp[i];
while(ss <= d){
ll x = d/ss, y = c/ss;
cnt[i] -= x-y;
ss*=pp[i];
}
}
bool bl = 1;
for(int i = 0; i < pp.size(); i++){
if(cnt[i] > 0) bl = 0;
cnt[i] = 0;
}
cout << (bl? "DA":"NE") << "\n";
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
for(int i = 2; i*i < lim; i++) if(prm[i]) for(int j = i*i; j < lim; j+=i) prm[j] = 0;
for(int i = 2; i < lim; i++) if(prm[i]) pp.pb(i);
cnt.assign(pp.size(), 0);
int T; cin >> T; while(T--) solve();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |