結果
| 問題 | No.1021 Children in Classrooms |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-25 17:36:56 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 2,000 ms |
| コード長 | 563 bytes |
| 記録 | |
| コンパイル時間 | 499 ms |
| コンパイル使用メモリ | 79,068 KB |
| 実行使用メモリ | 9,856 KB |
| 最終ジャッジ日時 | 2026-03-15 03:12:07 |
| 合計ジャッジ時間 | 2,324 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:18:48: warning: ignoring return value of 'bool std::operator!=(const _List_iterator<int>&, const _List_iterator<int>&)', declared with attribute 'nodiscard' [-Wunused-result]
18 | for(auto it = l.begin(); it != l.end(); it != l.end()){
| ~~~^~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/list:67,
from main.cpp:2:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_list.h:645:7: note: declared here
645 | operator!=(const _List_iterator& __x,
| ^~~~~~~~
ソースコード
#include<iostream>
#include<list>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
list<int> l;
for(int i = 0; i < n; i++){
int x; cin >> x;
l.push_back(x);
}
while(m--){
char c; cin >> c;
if(c == 'L') *(++l.begin()) += l.front(), l.pop_front(), l.push_back(0);
else *(----l.end()) += l.back(), l.pop_back(), l.push_front(0);
}
for(auto it = l.begin(); it != l.end(); it != l.end()){
cout << *it++, cout << (it == l.end() ? "\n" : " ");
}
return 0;
}