結果
| 問題 | No.982 Add |
| コンテスト | |
| ユーザー |
cureskol
|
| 提出日時 | 2020-02-11 16:09:42 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 392 bytes |
| 記録 | |
| コンパイル時間 | 1,093 ms |
| コンパイル使用メモリ | 186,428 KB |
| 実行使用メモリ | 7,976 KB |
| 最終ジャッジ日時 | 2026-04-17 08:22:52 |
| 合計ジャッジ時間 | 2,972 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 6 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:16:9: warning: ignoring return value of '_FIter std::unique(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]', declared with attribute 'nodiscard' [-Wunused-result]
16 | unique(v.begin(),v.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;
template<typename T>
void fin(T a){
cout<<a<<endl;
exit(0);
}
signed main(){
int a,b;cin>>a>>b;
if(__gcd(a,b)>1)fin(-1);
vector<int> v;
for(int i=0;i<1000;i++)for(int j=0;j<1000;j++)v.push_back(a*i+b*j);
sort(v.begin(),v.end());
unique(v.begin(),v.end());
int ans=0;
for(int i=0;i<1000;i++)ans+=v[i+1]-v[i]-1;
fin(ans);
}
cureskol