結果
問題 | No.1021 Children in Classrooms |
ユーザー |
|
提出日時 | 2020-04-10 21:30:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 77 ms / 2,000 ms |
コード長 | 411 bytes |
コンパイル時間 | 1,016 ms |
コンパイル使用メモリ | 73,824 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-15 19:15:21 |
合計ジャッジ時間 | 2,902 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main() | ^~~~
ソースコード
#include<iostream> #include<deque> using namespace std; int N,M; main() { cin>>N>>M; deque<int>P; for(int i=0;i<N;i++) { int A;cin>>A; P.push_back(A); } string s;cin>>s; for(char c:s) { if(c=='L') { int x=P[0];P.pop_front();P[0]+=x; P.push_back(0); } else { int x=P.back();P.pop_back();P.back()+=x; P.push_front(0); } } for(int i=0;i<N;i++)cout<<P[i]<<(i+1==N?'\n':' '); }