(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #475739

#TimeUsernameProblemLanguageResultExecution timeMemory
475739CaroLindaHop (COCI21_hop)C++14
110 / 110
242 ms1220 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= 1010 ; const int MAX_PRIMES = 664589 ; using namespace std ; int N ; int inDeg[MAX] , group[MAX] ; int mat[3][3] = { 3 , 1 , 1 ,2 , 3 , 1 , 2 , 2 , 3 } ; ll X[MAX]; int main() { scanf("%d", &N ); for(int i = 1 ; i <= N ; i++ ) { scanf("%lld", &X[i] ) ; for(int j = 1 ; j < i ; j++ ) if(__gcd(X[i],X[j]) == X[j]) inDeg[i]++ ; } vector<int> fila ; lp(i,1,N+1) if(inDeg[i] == 0 ) fila.pb(i) ; int ini = 0 ; while(ini < sz(fila)) { int x = fila[ini++] ; for(int j = x+1 ; j <= N ; j++ ) if( __gcd(X[x] , X[j]) == X[x] && (--inDeg[j]) == 0 ) { group[ j ] = group[ x ] + 1 ; group[j] %= 3 ; fila.pb(j) ; } } lp(i,1,N) { lp(j,1,i+1) printf("%d ", mat[group[j]][group[i+1]] ) ; printf("\n") ; } }

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", &N  );
      |  ~~~~~^~~~~~~~~~~~
Main.cpp:28:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |   scanf("%lld", &X[i] ) ;
      |   ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...