Submission #49503

#TimeUsernameProblemLanguageResultExecution timeMemory
49503lcs147Jetpack (COCI16_jetpack)C++98
72 / 80
1068 ms7960 KiB
#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; // desce 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(){ scanf("%d",&n); for(int i=0;i<10;i++){ scanf(" %s",tab[i]); } dfs(9,0); reverse(res.begin(),res.end()); printf("%d\n",res.size()); for(int i=0;i<res.size();i++){ printf("%d %d\n",res[i],1); } return 0; }

Compilation message (stderr)

jetpack.cpp: In function 'int main()':
jetpack.cpp:24:29: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
     printf("%d\n",res.size());
                   ~~~~~~~~~~^
jetpack.cpp:25:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<res.size();i++){
                 ~^~~~~~~~~~~
jetpack.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
jetpack.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" %s",tab[i]);
         ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...