답안 #701594

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
701594 2023-02-21T14:22:13 Z Alexabcde1 Xylophone (JOI18_xylophone) C++14
0 / 100
0 ms 296 KB
#include<bits/stdc++.h> 
#include "xylophone.h"
#define f first
#define s second
using namespace std;
long long n,i,j,ress[5005][5005],resp,neg,minn,maxx;
long long ans[5005];
long long res(long long x,long long y){
	if (ress[x][y]!=0) return ress[x][y];
	ress[x][y]=query(x,y);
	return ress[x][y];
}
void solve(int n){
	if (n==2){
		cout<<"A 1 2"<<endl;
		return;
	}
	ans[1]=0;
	for (i=1;i<=n-2;i++){
		if (res(i,i+1)+res(i+1,i+2)==res(i,i+2)){
			ans[i+1]=ans[i]+res(i,i+1);
			ans[i+2]=ans[i]+res(i,i+2);
			if (ans[i+2]>=n){
				ans[i+1]=ans[i]-res(i,i+1);
				ans[i+2]=ans[i]-res(i,i+2);
			}
		}
		else {
			ans[i+1]=ans[i]+res(i,i+1);
			ans[i+2]=ans[i+1]-res(i+1,i+2);
			if (ans[i+1]>=n){
				ans[i+1]=ans[i]-res(i,i+1);
				ans[i+2]=ans[i+1]+res(i+1,i+2);
			}
		}
		if (ans[i+2]<0 || ans[i+1]<0) neg=1;
	}
	maxx=1; minn=1;
	for (i=2;i<=n;i++){
		if (ans[i]>ans[maxx]) maxx=i;
		if (ans[i]<ans[minn]) minn=i;
	}
	if (maxx<minn) {
		for (i=1;i<=n;i++){
			ans[i]=-ans[i];
		}
	}
	minn=ans[1];
	for (i=2;i<=n;i++){
		minn=min(minn,ans[i]);
	}
	minn=-minn+1;
	for (i=1;i<=n;i++) answer(i,ans[i]+minn);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 296 KB Expected integer, but "A" found
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 296 KB Expected integer, but "A" found
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 296 KB Expected integer, but "A" found
2 Halted 0 ms 0 KB -