結果
| 問題 |
No.1395 Less Sweet Alchemy
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-14 21:51:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 978 bytes |
| コンパイル時間 | 663 ms |
| コンパイル使用メモリ | 81,048 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-22 09:23:20 |
| 合計ジャッジ時間 | 1,211 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 5 WA * 7 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:38:5: warning: 'mid' may be used uninitialized [-Wmaybe-uninitialized]
38 | if(mid>=x)cout<<"Yes"<<endl;
| ^~
main.cpp:24:8: note: 'mid' was declared here
24 | ll mid;
| ^~~
ソースコード
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <utility>
#include <list>
#include <algorithm>
typedef long long ll;
const ll INF=20000;
using namespace std;
int main(){
ll n,x;
cin>>n>>x;
ll ans=0;
vector<ll> C(n);
for(int i=0;i<n;i++)
{
cin>>C[i];
}
sort(C.begin(),C.end());
ll right=C[n-1];
ll left=C[0];
ll mid;
for(int i=n-1;i>0;i--)
{
mid=(right+left)/2;
if(mid<x)
{
mid=left;
}
else if(mid>x)
{
mid=right;
}
// cout<<mid<<endl;
}
if(mid>=x)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
/*
vector<vector<true>> dp(n+1,vector<ll>101,false);
dp[0][0]=true;
for(int k=0;k<=101;k++)
{
for(int i=0;i<=n;i++)
{
for(int j=0;j<=100;j++)
{
dp[i][j]=dp[i-1][j-C[k]]
}
}
}
*/
return 0;
}