結果
| 問題 | No.345 最小チワワ問題 |
| コンテスト | |
| ユーザー |
_EnumHack
|
| 提出日時 | 2016-02-28 01:34:08 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 459 bytes |
| 記録 | |
| コンパイル時間 | 3,399 ms |
| コンパイル使用メモリ | 227,020 KB |
| 実行使用メモリ | 7,976 KB |
| 最終ジャッジ日時 | 2026-04-11 16:53:07 |
| 合計ジャッジ時間 | 4,468 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 14 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/istream:43,
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/regex:44,
from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'int main()' at main.cpp:17:22:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:179:25: warning: 'result' may be used uninitialized [-Wmaybe-uninitialized]
179 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:10:12: note: 'result' was declared here
10 | size_t result;
| ^~~~~~
ソースコード
#include <regex>
#include <string>
#include <iostream>
int main(){
std::string str;
std::cin >> str;
std::smatch m;
size_t result;
if( std::regex_search(str, m, std::regex{"c.*w.*w"}) ){
while(std::regex_search(str, m, std::regex{"c.*w.*w"})){
result = m.str().length();
str = m.str();
str.pop_back();
}
std::cout << result << std::endl;
}
else{
std::cout << -1 << std::endl;
}
return 0;
}
_EnumHack