結果
問題 | No.1021 Children in Classrooms |
ユーザー |
![]() |
提出日時 | 2020-04-17 17:15:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 1,635 bytes |
コンパイル時間 | 1,758 ms |
コンパイル使用メモリ | 172,256 KB |
実行使用メモリ | 5,332 KB |
最終ジャッジ日時 | 2024-10-03 10:27:00 |
合計ジャッジ時間 | 3,618 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define FOR(i,o,n) for(long long i = o;i<n;i++) #define oneforall ios::sync_with_stdio(false);cin.tie(0); #define all(v) (v).begin(),(v).end() #define ini(...) int __VA_ARGS__; in(__VA_ARGS__) #define inl(...) long long __VA_ARGS__; in(__VA_ARGS__) #define ins(...) string __VA_ARGS__; in(__VA_ARGS__) #define int long long const long long INF=1e18; void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);} void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);} typedef vector<int> vi; typedef vector<long long> vl; typedef long long ll; typedef vector<pair<long, long > > vpll; typedef vector<pair<int, int > > vpii; int32_t main() { oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall oneforall ini(n); ini(n1); deque<int> morty; FOR(i,0,n){ ini(x); morty.push_back(x); } ins(morty1); FOR(i,0,n1){ if(morty1[i] == 'L'){ int x1 = morty.front();morty.pop_front(); int x2 = morty.front();morty.pop_front(); morty.push_front(x1+x2); morty.push_back(0); } else{ int x1 = morty.back();morty.pop_back(); int x2 = morty.back();morty.pop_back(); morty.push_back(x1+x2); morty.push_front(0); } } for(auto v:morty){cout<<v<<" ";} return 0; }