# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
133155 | forelax | Jetpack (COCI16_jetpack) | C++14 | 170 ms | 11196 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int main(){
int r=10,c;
cin>>c;
vector<vector<char> > ch(r,vector<char> (c));
vector<vector<int> > v(r,vector<int> (c,-1));
vector<vector<int> > st(r,vector<int> (c));
for(int i = 0 ; i < r ; i ++){
for(int j = 0 ; j < c ; j ++){
cin>>ch[i][j];
}
}
for(int i = 0 ; i < r ; i ++)
if(ch[i][c-1]=='.'){
v[i][c-1]=min(i+1,r-1);
st[i][c-1]=1;
}
for(int j = c-2 ; j >= 0 ; j --){
for(int i = 0 ; i < r ; i ++){
if(ch[i][j]=='X')continue;
int p1=min(r-1,i+1);
int p2=max( 0 ,i-1);
if(v[p1][j+1]!=-1){
v[i][j]=p1;
st[i][j]=1;
}else if(v[p2][j+1]!=-1){
v[i][j]=p2;
st[i][j]=2;
}
}
}
// for(int i = 0 ; i < r ; i ++){
// for(int j = 0 ; j < c ; j ++){
// cout<<v[i][j]<<" ";
// }
// cout<<endl;
// }
// for(int i = 0 ; i < r ; i ++){
// for(int j = 0 ; j < c ; j ++){
// cout<<st[i][j]<<" ";
// }
// cout<<endl;
// }
vector<int> ast(c);
for(int i = 0,cr=9 ; i < c ; i ++){
ast[i]=st[cr][i]-1;
cr=v[cr][i];
}
vector<pair<int,int> > rz;
for(int i = 0,j ; i < c ; i ++){
if(ast[i]){
for(j = i ; j<c&&ast[j] ; j ++);
rz.push_back({i,j-i});
i=j;
}
}
cout<<rz.size()<<endl;
for(int i = 0 ; i < rz.size() ; i ++){
cout<<rz[i].first<<" "<<rz[i].second<<endl;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |