結果
| 問題 |
No.149 碁石の移動
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-08-30 22:51:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 785 bytes |
| コンパイル時間 | 693 ms |
| コンパイル使用メモリ | 87,884 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 03:27:45 |
| 合計ジャッジ時間 | 1,484 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 13 |
ソースコード
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>
#define N 1000
#define re(i,n) for(int i=0;i<(n);i++)
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define fe(i,n,f) for_each(i,n,f)
#define bw(a,b,c) (((a)<=(b))&&((b)<=(c)))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main(void){
int a,b,c,d,e,f;
cin>>a>>b>>c>>d>>e>>f;
int s,t;
s=max(e-b,0); //pw
t=min(b,e); //pb
a-=s;
b-=t;
c+=s;
d+=t;
t=max(f-c,0);
s=min(c,f);
c-=s;
d-=t;
a+=s;
b+=t;
cout<<a<<endl;
return 0;
}