結果
| 問題 | No.701 ひとりしりとり |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-24 12:59:38 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 765 bytes |
| 記録 | |
| コンパイル時間 | 982 ms |
| コンパイル使用メモリ | 188,268 KB |
| 実行使用メモリ | 9,700 KB |
| 最終ジャッジ日時 | 2026-03-21 09:13:46 |
| 合計ジャッジ時間 | 2,720 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 12 |
コンパイルメッセージ
main.cpp: In member function 'std::vector<std::__cxx11::basic_string<char> > No701::generateList(int)':
main.cpp:28:11: warning: ignoring return value of '_FIter std::unique(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<__cxx11::basic_string<char>*, vector<__cxx11::basic_string<char> > >]', declared with attribute 'nodiscard' [-Wunused-result]
28 | unique(a.begin(),a.end());
| ~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/algorithm:63,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:53,
from main.cpp:1:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algo.h:875:5: note: declared here
875 | unique(_ForwardIterator __first, _ForwardIterator __last)
| ^~~~~~
ソースコード
#include<bits/stdc++.h>
using namespace std;
class No701{
private :
string tmp;
vector<string> a;
string generateString(){
string t = "";
t += tmp[tmp.size()-1];
for(int i = 0;i < rand()%20+1;i++){
t += char(rand()%25+97);
}
tmp = t;
a.push_back(tmp);
return t;
}
public :
No701(string s){
tmp=s;
}
vector<string> generateList(int n){
for(int i=0;i<n;i++){
generateString();
}
do{
unique(a.begin(),a.end());
if(a.size() < n)generateString();
}while(a.size() != n);
return a;
}
};
int main(){
ios::sync_with_stdio(false);
int N;
cin >> N;
No701 no701("hello");
vector<string> a = no701.generateList(N);
for(string e : a){
cout << e << endl;
}
return 0;
}