結果
| 問題 | No.204 ゴールデン・ウィーク(2) |
| コンテスト | |
| ユーザー |
fal_rnd
|
| 提出日時 | 2017-02-18 13:43:54 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 982 bytes |
| 記録 | |
| コンパイル時間 | 1,709 ms |
| コンパイル使用メモリ | 177,672 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-30 08:05:55 |
| 合計ジャッジ時間 | 2,603 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:20:16: warning: ignoring return value of 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]', declared with attribute 'nodiscard' [-Wunused-result]
20 | cin.tie();ios::sync_with_stdio(false);
| ~~~~~~~^~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ios:48,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/istream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/sstream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/complex:50,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ccomplex:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:133,
from main.cpp:1:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/basic_ios.h:310:7: note: declared here
310 | tie() const
| ^~~
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,s,g) for(int i=s;i<g;i++)
#define REP(i, n) for(int i=0;i<n;i++)
using ull = unsigned long long;
using ll = long long;
const char en = '\n';
const ull INFL = 810000001919114514;
const ull INF = 1919114514;
int d;
using D = vector<int>;
D in;
int main(){
cin.tie();ios::sync_with_stdio(false);
cin>>d;
char curc='x',buf;
int curv=114514;
REP(i,14){
cin>>buf;
if(buf==curc){
curv++;
}else{
curc=buf;
in.push_back(curv);
curv=1;
}
}
if(curc=='x'){
in.push_back(curv+114514);
}else{
in.push_back(curv);
in.push_back(114514);
}
in.push_back(0);
/*
for(int i=0;i<in.size();i++){
cout<<in[i]<<' ';
}
cout<<en;
*/
int result=d+in[1];
for(int i=2;i<in.size()-1;i+=2){
if(in[i]<=d){
result=max(result,in[i-1]+in[i]+in[i+1]);
}else{
result=max(result, in[i-1]+d);
result=max(result, in[i+1]+d);
}
}
cout<<result<<en;
return 0;
}
fal_rnd