Submission #49504

#TimeUsernameProblemLanguageResultExecution timeMemory
49504lcs147Jetpack (COCI16_jetpack)C++98
80 / 80
18 ms5276 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 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(){ 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:25: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:26:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<res.size();i++){
                 ~^~~~~~~~~~~
jetpack.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
jetpack.cpp:21: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...