結果
| 問題 | No.600 かい文回 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-11-27 12:30:55 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 586 bytes |
| 記録 | |
| コンパイル時間 | 416 ms |
| コンパイル使用メモリ | 88,972 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2026-09-30 19:32:56 |
| 合計ジャッジ時間 | 6,562 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 TLE * 1 -- * 18 |
コンパイルメッセージ
main.cpp: In function 'std::string solve(int)':
main.cpp:36:46: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = char_traits<char>; _Alloc = allocator<char>]', declared with attribute 'nodiscard' [-Wunused-result]
36 | if (n % 2 == 0) foo() + solve(n / 2) + foo();
| ^
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/string:56,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/locale_classes.h:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/ios_base.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/ios:46,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/ostream.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/iostream:43,
from main.cpp:1:
/home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/basic_string.h:3936:5: note: declared here
3936 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
char pt0 = 'p';
char pt1 = 'q';
void step() {
pt1++;
if (pt1 > 'z') {
pt0++;
pt1 = pt0 + 1;
}
}
string foo() {
string ret;
ret += pt0;
ret += pt1;
return ret;
}
string bar() {
string ret;
ret += pt0;
ret += pt1;
step();
return ret;
}
string solve(int n) {
if (n == 1) return bar();
if (n % 2 == 0) foo() + solve(n / 2) + foo();
string t = bar();
return t + solve(n - 1) + t;
}
int main() {
int n;
cin >> n;
cout << solve(n) << endl;
}