Submission #475735

#TimeUsernameProblemLanguageResultExecution timeMemory
475735CaroLindaVepar (COCI21_vepar)C++14
0 / 70
617 ms524292 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 ; vector< int > sub[MAX+10] , soma[MAX+10] ; int qtd[15][664589] , freq[664589] ; int idx[MAX+10] , d[MAX+10] ; int node = 0 ; int main() { scanf("%d", &T ) ; for(int i = 1 ; i <= T ; i++ ) { int a , b , c , d ; scanf("%d %d %d %d", &a, &b, &c, &d ) ; soma[a-1].pb(i) ; sub[b].pb(i) ; sub[c-1].pb(i) ; soma[d].pb(i) ; } for(int i = 2 ; i <= MAX ; i++ ) { if(d[i] == 0) { idx[i] = ++node ; for(int j = i ; j <= MAX ; j += i) if(d[j] == 0) d[j] = i ; } int x = i ; while(x > 1) { int p = d[x] ; freq[ idx[p] ]++ ; x /= p ; } for(auto e : sub[i]) for(int j = 1 ; j <= node ; j++ ) qtd[e][j] -= freq[j] ; for(auto e : soma[i]) for(int j = 1 ; j <= node ; j++ ) qtd[e][j] += freq[j] ; } for(int i = 1 ; i <= T ; i++ ) { bool ok = true ; for(int j = 1 ; j <= node ; j++ ) ok &= ( qtd[i][j] >= 0 ) ; printf("%s\n" , ok ? "DA" : "NE") ; } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |  scanf("%d", &T ) ;
      |  ~~~~~^~~~~~~~~~~
Main.cpp:29:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |   scanf("%d %d %d %d", &a, &b, &c, &d ) ;
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...