# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
94503 | ahmedie404 | Jetpack (COCI16_jetpack) | C++14 | 94 ms | 66560 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
using namespace std;
int n;
string s;
string ns[11];
bool isfound=false;
bool valid(int x, int y){
return x >= 0 && x < 10 && y >= 0 && y <= n;
}
void DFS(int x, int y, int second, bool isclicked, int startedsecond, string str, int p){
ns[x][y] = 'X';
if(isfound == true) return;
if(y == n){
if(isclicked == 0 && startedsecond == -1){
isfound =true;
int c=0;
for(int i=0;i<str.length();i++)
if(str[i] == ' ')
c++;
cout << c << endl;
cout << str << endl;
}
return;
}
if(valid(x, y+1) && ns[x][y+1] != 'X' && x == 9)
DFS(x, y+1, second+1, false, -1, str, p);
if(valid(x-1, y+1) && ns[x-1][y+1] != 'X')
DFS(x-1, y+1, second+1, true, isclicked == true ? startedsecond : second, str, p);
else
if(x == 0 && ns[x][y+1] != 'X')
DFS(x, y+1, second+1, true, isclicked == true ? startedsecond : second, str, p);
if(valid(x+1, y+1) && ns[x+1][y+1] != 'X'){
if(isclicked)
str = str + to_string(startedsecond) + " " + to_string(second-startedsecond) + "\n";
DFS(x+1, y+1, second+1, false, -1, str, p+1);
}
}
int main(){
cin >> n;
for(int i=0;i<10;i++){
cin >> ns[i];
}
DFS(9, 0, 0, false, 0, "", 0);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |