Submission #95238

#TimeUsernameProblemLanguageResultExecution timeMemory
95238easruiPyramid Base (IOI08_pyramid_base)C++14
0 / 100
2 ms424 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...