# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
171670 | Tuk1352 | Jetpack (COCI16_jetpack) | C++11 | 124 ms | 10500 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 n;
cin >> n;
char C[10][n];
int D[10][n+1], P[10][n+1], I, Y=n-1;
for (int i = 0; i < 10; i++)
{
for (int y = 0; y < n; y++)
{
cin >> C[i][y];
P[i][y] = 0;
}
}
for (int i = 0; i < 10; i++)
{
D[i][0] = 0;
}
D[9][0] = 1;
for (int y = 1; y < n; y++)
{
for (int i = 0; i < 10; i++)
{
D[i][y] = 0;
if (C[i][y] != 'X')
{
if (i == 9)
{
if (D[i][y-1] == 1)
{
D[i][y] = 1;
}
else if (D[i-1][y-1] == 1)
{
D[i][y] = 1;
P[i][y] = -1;
}
}
else if (i == 0)
{
if (D[i][y-1] == 1)
{
D[i][y] = 1;
}
else if (D[i+1][y-1] == 1)
{
D[i][y] = 1;
P[i][y] = 1;
}
}
else
{
if (D[i-1][y-1] == 1)
{
P[i][y] = -1;
D[i][y] = 1;
}
else if (D[i+1][y-1] == 1)
{
P[i][y] = 1;
D[i][y] = 1;
}
}
}
}
}
for (int i = 0; i < 9; i++)
{
if (D[i][n-1] == 1)
{
I = i;
}
}
vector <pair<int,int>> V;
int k = 0;
while (Y != -1)
{
if (P[I][Y] == 1 || (P[I][Y] == 0 && I == 0))
{
k++;
}
else if (k != 0)
{
V.push_back({Y,k});
k = 0;
}
I += P[I][Y];
Y--;
}
cout << V.size() << "\n";
for (int i = V.size()-1; i >= 0; i--)
{
cout << V[i].first << " " << V[i].second << "\n";
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |