# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
489666 |
2021-11-23T18:17:44 Z |
inksamurai |
Vepar (COCI21_vepar) |
C++17 |
|
857 ms |
91096 KB |
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define crep(i,x,n) for(int i=x;i<n;i++)
#define drep(i,n) for(int i=n-1;i>=0;i--)
#define vec(...) vector<__VA_ARGS__>
#define _3oIUrY0 ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
using pii=pair<int,int>;
using vi=vector<int>;
const int _n=1e7+10;
int a[_n],b[_n];
bool sv[_n];
int main(){
_3oIUrY0;
for(int i=2;i<=_n;i++){
if(sv[i]) continue;
for(int j=2*i;j<=_n;j+=i){
if(sv[j]==0) sv[j]=i;
}
}
vi prms;
for(int i=2;i<=_n;i++){
if(!sv[i]){
prms.pb(i);
}
}
auto f=[&](int prm,int n)->int{
if(prm>n) return 0;
int x=prm;
vi rbts;
while(x<=n){
rbts.pb(x);
x*=prm;
}
int _sum=0,now=0;
drep(i,sz(rbts)){
x=rbts[i];
now+=((n/x)-_sum)*(i+1);
_sum+=((n/x)-_sum);
}
return now;
};
int t;
cin>>t;
rep(cs,t){
int _a,_b,_c,_d;
cin>>_a>>_b>>_c>>_d;
for(auto prm : prms){
b[prm]+=f(prm,_b);
b[prm]-=f(prm,_a-1);
a[prm]+=f(prm,_d);
a[prm]-=f(prm,_c-1);
}
bool pok=1;
for(auto prm : prms){
if(b[prm]>a[prm]){
// cout<<a[prm]<<"\n";
pok=0;
break;
}
a[prm]=b[prm]=0;
}
cout<<(pok?"DA":"NE")<<"\n";
}
//
return 0;
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:25:10: warning: iteration 10000008 invokes undefined behavior [-Waggressive-loop-optimizations]
25 | if(sv[i]) continue;
| ~~~~^
Main.cpp:24:15: note: within this loop
24 | for(int i=2;i<=_n;i++){
| ~^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
288 ms |
91012 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
281 ms |
91084 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
271 ms |
91056 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
492 ms |
91096 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
855 ms |
91036 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
857 ms |
91088 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
833 ms |
91080 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |