Submission #475735

# Submission time Handle Problem Language Result Execution time Memory
475735 2021-09-23T22:39:24 Z CaroLinda Vepar (COCI21_vepar) C++14
0 / 70
617 ms 524292 KB
#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

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 time Memory Grader output
1 Runtime error 617 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 600 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 585 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 520 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 581 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 567 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 597 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -