結果
| 問題 | No.994 ばらばらコイン |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-27 14:43:42 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 392 bytes |
| 記録 | |
| コンパイル時間 | 1,166 ms |
| コンパイル使用メモリ | 180,664 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-01 02:50:05 |
| 合計ジャッジ時間 | 2,855 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:64,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/algorithm:62,
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:
In member function 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::__conditional_t<((bool)std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value), std::pair<_T1, _T2>&&, std::__nonesuch&&>) [with _T1 = int; _T2 = int]',
inlined from 'int main()' at main.cpp:14:25:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_pair.h:958:16: warning: 'b' may be used uninitialized [-Wmaybe-uninitialized]
958 | second = std::forward<second_type>(__p.second);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp: In function 'int main()':
main.cpp:12:15: note: 'b' was declared here
12 | int a,b;
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
long long n,k;
cin>>n>>k;
int result = -1;
vector<pair<int,int>> vertices(n-1);
for (int i = 0; i < vertices.size(); i++)
{
int a,b;
cin>>a,b;
vertices[i]={a,b};
}
if(n<k)
cout<<result;
else
cout<<k-1;
}