이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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]);
}
컴파일 시 표준 에러 (stderr) 메시지
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;
~~~~^~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |