Submission #95238

# Submission time Handle Problem Language Result Execution time Memory
95238 2019-01-29T00:21:15 Z easrui Pyramid Base (IOI08_pyramid_base) C++14
0 / 100
2 ms 424 KB
#include <bits/stdc++.h>
using namespace std;
int N,M,X,Y,Z,u,d,tmpx;
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0);
    string S;
    cin >> N >> M >> S;
    for(int i=0; i<S.size(); i++) {
        tmpx = X;
        X = 2*Y + Z;
        Y = tmpx;
        if(S[i]=='P' && u!=2) {
            if(u==1) X++;
            else if(d==-2) Y++;
            else Z++;
        }
        if(S[i]=='L'){
            u = max(u+1,1);
            d = d+1;
        }
        else{
            u = u-1;
            d = min(d-1,-1);
        }
        X %= M; Y %= M; Z %= M;
    }
    cout << (X+Y+Z+1)%M;
}

Compilation message

pyramid_base.cpp: In function 'int main()':
pyramid_base.cpp:9:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<S.size(); i++) {
                  ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 380 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 424 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -