| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1115724 | ahoraSoyPeor | Circle Passing (EGOI24_circlepassing) | C++14 | 78 ms | 9248 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef pair <int,int> pii;
int N, M, Q;
vector <int> bff;
int dist ( int a, int b ) {
return min ( abs(b-a), 2*N-abs(b-a) );
}
bool check_bff ( int a, int b ) {
auto pnt_a = lower_bound ( bff.begin(), bff.end(), a ),
pnt_b = upper_bound ( bff.begin(), bff.end(), b );
if ( a <= b )
return pnt_b - pnt_a > 0;
return pnt_a != bff.end() or pnt_b != bff.begin();
}
int get_ans ( int x_i, int y_i ) {
int d_x = dist ( x_i, y_i ), bff_x = (x_i+N)%(2*N);
int res = d_x;
if ( check_bff ( y_i, bff_x ) )
res = min ( res, dist ( y_i, bff_x ) + 1 );
return res;
}
int main () {
#ifndef LOCAL
#endif
scanf ( "%d%d%d", &N, &M, &Q );
while ( M-- ) {
int curr_bff;
scanf ( "%d", &curr_bff );
bff.pb ( curr_bff ), bff.pb ( curr_bff + N );
}
sort ( bff.begin(), bff.end() );
while ( Q-- ) {
int x_i, y_i;
scanf ( "%d%d", &x_i, &y_i );
printf ( "%d\n", get_ans ( x_i, y_i ) );
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
