| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 136155 | PedroBigMan | 송금 (JOI19_remittance) | C++14 | 2 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <stdlib.h>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=a; i<b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define INF ((ll) pow(2,63) -1)
ll insig;
#define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);}
void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
bool ped(ll N, vector<ll> A, vector<ll> B)
{
ios_base::sync_with_stdio(0);
cin.tie(0);
bool al0=true;
REP(i,0,N)
{
if(B[i]>0) {al0=false;};
}
vector<ll> dif; REP(i,0,N) {dif.pb(A[i]-B[i]);}
bool changed; ll mx,pos,pas;
while(1>0)
{
Out(dif);
changed=false; mx=1;
REP(i,0,N)
{
if(dif[i]>mx) {mx=dif[i]; pos=i; changed=true;}
}
if(!changed)
{
sort(dif.begin(),dif.end());
if(dif[0]==dif[N-1] && dif[0]==0) {return true;}
if(dif[0]==dif[N-1] && dif[0]==1 && !al0) {return true;}
return false;
}
pas=(ll) floor((ld) dif[pos]/2);dif[pos]%=2;
if(pos<=N-2)
{
dif[pos+1]+=pas;
}
else
{
dif[0]+=pas;
}
}
}
int main()
{
ll s; vector<ll> A; vector<ll> B;
cin>>s; In(A,s); In(B,s);
if(ped(s,A,B)) {cout<<"Yes"<<endl;}
else {cout<<"No"<<endl;}
return 0;
}컴파일 시 표준 에러 (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... | ||||
