답안 #648337

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
648337 2022-10-06T07:41:38 Z Trisanu_Das Jetpack (COCI16_jetpack) C++17
80 / 80
31 ms 5964 KB
#include<bits/stdc++.h>
using namespace std;
 
vector<int>res;
char tab[20][100010];
int n;
int dfs(int l,int c){
    if(tab[l][c]=='X')return 0;
    if(c==n-1)return 1;
    tab[l][c]='X';
    if(dfs(min(9,l+1),c+1) == 1) return 1;
    else if(dfs(max(0,l-1),c+1) == 1){
        res.push_back(c);
        return 1;
    }
    return 0;
}
int main(){
    cin >> n;
    for(int i=0;i<10;i++) cin >> tab[i];
    dfs(9,0);
    reverse(res.begin(),res.end());
    cout << res.size() << '\n';
    for(int i = 0;i < res.size(); i++) cout << res[i] << ' ' << 1 << '\n';;
    return 0;
}

Compilation message

jetpack.cpp: In function 'int main()':
jetpack.cpp:24:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i = 0;i < res.size(); i++) cout << res[i] << ' ' << 1 << '\n';;
      |                   ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 448 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 6 ms 1364 KB Output is correct
8 Correct 13 ms 2884 KB Output is correct
9 Correct 20 ms 4292 KB Output is correct
10 Correct 31 ms 5964 KB Output is correct