Submission #475733

#TimeUsernameProblemLanguageResultExecution timeMemory
475733CaroLindaVepar (COCI21_vepar)C++14
0 / 70
1609 ms337800 KiB
#include <bits/stdc++.h> #define mkt make_tuple #define all(x) x.begin(),x.end() #define sz(x) (int)(x.size()) #define ll long long #define lp(i,a,b) for(int i = a ; i < b ; i++ ) #define pii pair<int,int> #define mk make_pair #define pb push_back const int MAX= 10000000 ; using namespace std ; int T ; int l[2] , r[2] , q[2] ; int d[MAX+10] , idx[MAX+10] ; vector< vector<int> > lists ; vector<int> primes ; int main() { for(int i = 2 ; i <= MAX ; i++ ) { if(d[i] > 0 ) continue ; for(int j = i ; j <= MAX ; j += i ) if(d[j] == 0 ) d[j] = i ; } for(int i = 2 ; i <= MAX ; i++ ) { if(d[i] == i) { idx[i] = sz(primes) ; primes.push_back(i) ; lists.push_back( {i} ) ; continue ; } int x = i ; while(x>1) { int p = d[x] ; lists[idx[p]].pb( i ) ; x /= p ; } } scanf("%d", &T ) ; while(T--) { bool ok = true ; for(int i = 0 ; i < 2 ; i++ ) scanf("%d %d", &l[i], &r[i]) ; for(auto e : lists) { for(int i = 0 ; i < 2 ; i++ ) q[i] = upper_bound(all(e), r[i])-lower_bound(all(e) , l[i]) ; if(q[0] > q[1]) { ok = false ; break ; } } printf("%s\n" , ok ? "DA" : "NE") ; } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:51:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |  scanf("%d", &T ) ;
      |  ~~~~~^~~~~~~~~~~
Main.cpp:55:38: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |   for(int i = 0 ; i < 2 ; i++ ) scanf("%d %d", &l[i], &r[i]) ;
      |                                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...