# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
251303 | jimmy123 | Lollipop (POI11_liz) | C++14 | 487 ms | 19832 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX_NUM = 1000000;
char data[MAX_NUM+1];
int location[2*MAX_NUM+1]={0};
int main(){
int num=0, query=0, cnt=1, pos=0, first_W=-1, last_W=-1, range;
bool isfirst = true, got = false;
scanf("%d%d%s", &num, &query, data);
for(int i=0;i<num;++i){
if(data[i] == 'W'){
pos += 1;
last_W = pos;
if(isfirst){
first_W = pos;
isfirst = false;
}
}
else
pos += 2;
location[pos] = cnt;
cnt += 1;
}
for(int i=0;i<query;++i){
if(i != 0)
printf("\n");
got = false;
scanf("%d", &range);
if(location[range] != 0){
printf("1 %d", location[range]);
continue;
}
if(first_W != -1 && first_W < range){
if(first_W+range<=2*MAX_NUM && location[first_W+range] != 0){
printf("%d %d", location[first_W]+1, location[first_W+range]);
got = true;
}
else if(first_W+range-1<=2*MAX_NUM && location[first_W+range-1] != 0){
printf("%d %d", location[first_W-1]+1, location[first_W+range-1]);
got = true;
}
}
if(last_W != -1 && last_W > range && !got){
if(last_W-range<=2*MAX_NUM && location[last_W-range] != 0){
printf("%d %d", location[last_W-range]+1, location[last_W]);
got = true;
}
else if(last_W-range-1<=2*MAX_NUM && location[last_W-range-1] != 0){
printf("%d %d", location[last_W-range-1]+1, location[last_W-1]);
got = true;
}
}
// 找不到解
if(!got)
printf("NIE");
}
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... |
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |