# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
251108 | Mercenary | 송금 (JOI19_remittance) | C++14 | 306 ms | 28752 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#define pb push_back
#define mp make_pair
#define taskname "A"
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef tree <pair<ll,int>,null_type,less<pair<ll,int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int maxn = 1e6 + 5;
int n;
int a[maxn] , b[maxn];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
if(fopen(taskname".INP","r")){
freopen(taskname".INP", "r",stdin);
freopen(taskname".OUT", "w",stdout);
}
cin >> n;
for(int i = 0 ; i < n ; ++i){
cin >> a[i] >> b[i];
}
do{
bool ok = 0;
for(int i = 0 ; i < n ; ++i){
if(a[i] <= b[i] || a[i] <= 1)continue;
int tmp = max(1 , (a[i] - b[i]) / 2);
a[i] -= 2 * tmp;
a[(i + 1) % n] += tmp;
ok = 1;
}
if(!ok)break;
}while(true);
for(int i = 0 ; i < n ; ++i){
if(a[i] != b[i])return cout << "No" , 0;
}
cout << "Yes";
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |