# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
133289 |
2019-07-20T11:22:24 Z |
tdwn |
Jetpack (COCI16_jetpack) |
C++17 |
|
127 ms |
10860 KB |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn = 100100;
char maze[11][maxn];
int t[11][maxn];
int direction[11][maxn];
int n;
int main() {
cin>>n;
for(int i=1;i<=10;i++) {
for(int j=1;j<=n;j++) {
cin>>maze[i][j];
t[i][j] = -1;
}
}
t[10][1] = 0;
// Direction:
// 0 -> from left (only last row)
// 1 -> felt from above
// 2 -> from down
for(int j=2;j<=n;j++) {
for(int i=1;i<=10;i++) {
if(maze[i][j] == 'X') continue;
if(i == 10) {
if(t[i][j-1] != -1) {
direction[i][j] = 0;
t[i][j] = t[i][j-1] + 1;
}
if(t[i-1][j-1] != -1) {
direction[i][j] = 1;
t[i][j] = t[i-1][j-1] + 1;
}
}
else if(i == 1) {
if(t[i-1][j-1] != -1) {
t[i][j] = t[i-1][j-1] + 1;
direction[i][j] = 2;
}
}
else {
if(t[i-1][j-1] != -1) {
t[i][j] = t[i-1][j-1] + 1;
direction[i][j] = 1;
}
if(t[i+1][j-1] != -1) {
t[i][j] = t[i+1][j-1] + 1;
direction[i][j] = 2;
}
}
}
}
int ind = -1;
for(int i=1;i<=10;i++) {
if(t[i][n] != -1) {
ind = i;
}
}
vector<pair<int,int> > v;
for(int j=n;j>=1;j--) {
if(direction[ind][j] == 0) {
continue;
}
else if(direction[ind][j] == 1) {
ind--;
}
else if(direction[ind][j] == 2){
v.pb(mp(t[ind+1][j-1],1));
ind++;
}
}
cout<<v.size()<<"\n";
reverse(v.begin(), v.end());
for(auto i:v) {
cout<<i.first<<" "<<i.second<<"\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Incorrect |
3 ms |
504 KB |
Moves are not sorted in chronological order. |
5 |
Incorrect |
7 ms |
1016 KB |
Moves are not sorted in chronological order. |
6 |
Incorrect |
10 ms |
1144 KB |
Integer -1 violates the range [0, 6270] |
7 |
Incorrect |
26 ms |
2592 KB |
Integer -1 violates the range [0, 19292] |
8 |
Incorrect |
60 ms |
5500 KB |
Integer -1 violates the range [0, 47489] |
9 |
Incorrect |
91 ms |
8176 KB |
Integer -1 violates the range [0, 72178] |
10 |
Incorrect |
127 ms |
10860 KB |
Integer -1 violates the range [0, 99999] |