답안 #58358

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
58358 2018-07-17T14:46:02 Z khohko Xylophone (JOI18_xylophone) C++17
0 / 100
3 ms 308 KB
#include <bits/stdc++.h>
#include "xylophone.h"
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define pb push_back
//#define mp make_pair
#define fr first
#define sc second
#define MAX ((ll)(1e17+100))
#define MX ((ll)(1e5+100))
#define ARRS ((ll)(1e6+100))
#define ARS ((ll)(1e3+100))
#define HS ((ll)(233))
#define MOD ((ll)(1e9+7))
#define EP ((double)(1e-9))
#define LG 21
#define mul(a,b) a=((a)*(b))%MOD
using namespace std;


ll a[ARRS];

void solve(int n) {
	ll l,r;

	for(int i=1; i<=n; i++)
		if(query(1,i)==n-1){r=i;break;}
	for(int i=n; i>=1; i--)
		if(query(i,n)==n-1){l=i;break;}
	//cout<<l<<" "<<r<<endl;
	a[l]=1;
	a[r]=n;

	for(ll i=1; i<=n; i++){
		if(i==l||i==r)continue;
		if(i<r)
			a[i]=1+query(min(i,l),max(i,l));
		else 
			a[i]=n-query(min(i,r),max(i,r));
	}


	for(int i = 1; i <= n; i++) 
		answer(i, a[i]);

}


Compilation message

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:32:6: warning: 'l' may be used uninitialized in this function [-Wmaybe-uninitialized]
  a[l]=1;
  ~~~~^~
xylophone.cpp:33:6: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
  a[r]=n;
  ~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 308 KB Output is correct
3 Incorrect 3 ms 308 KB Wrong Answer [7]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 308 KB Output is correct
3 Incorrect 3 ms 308 KB Wrong Answer [7]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 308 KB Output is correct
3 Incorrect 3 ms 308 KB Wrong Answer [7]
4 Halted 0 ms 0 KB -