제출 #538282

#제출 시각아이디문제언어결과실행 시간메모리
538282jamielimHop (COCI21_hop)C++14
110 / 110
64 ms5604 KiB
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ii,ii> i4;
const int MOD=1000000007;
const int INF=1012345678;
const ll LLINF=1012345678012345678LL;
const double PI=3.1415926536;
const double EPS=1e-14;

int n;
ll arr[1005];
int ans[1005][1005];
set<int> adj[1005]; // graph of division thingy is a dag
int dist[1005];

int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%lld",&arr[i]);
	memset(ans,-1,sizeof(ans));
	for(int i=1;i<n;i++){
		for(int j=0;j<i;j++){
			if(arr[i]%arr[j]!=0){
				ans[j][i]=3;
			}else{
				adj[j].insert(i);
			}
		}
	}
	
	for(int i=0;i<n;i++){
		for(int j:adj[i]){
			dist[j]=max(dist[j],dist[i]+1);
		}
	}
	
	for(int i=0;i<n;i++){
		for(int j:adj[i]){
			if(dist[j]/4==dist[i]/4)ans[i][j]=1;
			else if(dist[j]/16==dist[i]/16)ans[i][j]=2;
			else ans[i][j]=3;
		}
	}
	
	for(int i=1;i<n;i++){
		for(int j=0;j<i;j++){
			printf("%d ",ans[j][i]);
		}
		printf("\n");
	}
}

컴파일 시 표준 에러 (stderr) 메시지

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