# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
932816 | De3b0o | Mensza (COI22_mensza) | C++17 | 6435 ms | 524288 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define er erase
#define pb push_back
#define ppb pop_back()
#define ph push
#define pp pop()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "YES" << "\n";
#define no cout << "NO" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid (l+r)/2
using namespace std;
ll fp(ll x , ll y)
{
if(y==0)
return 1;
ll z = fp(x,y/2);
if(y&1)
return z*z*x;
else
return z*z;
}
int sqrot(ll x)
{
int l = 0 , r = INT_MAX;
while(l<=r)
{
if(mid*mid>=x)
r=mid-1;
else
l=mid+1;
}
return r+1;
}
ll cel(ll x , ll y)
{
return x/y + bool(x/y);
}
string tb(ll x)
{
string s = "";
while(x>0)
{
if(x&1)
s+='1';
else
s+='0';
x/=2;
}
while(s.size()<60)
s+='0';
return s;
}
ll fb(string s)
{
ll x = 0;
ll c = 1;
for(int8_t i = 0 ; 60>i ; i++)
{
if(s[i]=='1')
x+=c;
c*=2;
}
return x;
}
int main()
{
ll L;
cin >> L;
ll q;
cin >> q;
while(q--)
{
string s;
cin >> s;
if(s=="alojzije")
{
ll A;
cin >> A;
vector<ll> a;
if(A>110)
{
ll x = A/10;
x/=2;
ll y = A/10;
y = y/2 + y%2;
while(x--)
a.pb(10000000);
while(y--)
a.pb(100000000);
A=A%10;
}
while(A--)
a.pb(A);
cout << a.size() << " ";
for(int i = 0 ; a.size()>i ; i++)
cout << a[i] << " ";
lin
}
else if(s=="benjamin")
{
ll B;
cin >> B;
vector<ll> b;
if(B>110)
{
ll x = B/10;
while(x--)
b.pb(1000000);
B=B%10;
}
while(B>=2)
{
b.pb(10000-B);
b.pb(10000-B);
B-=2;
}
cout << b.size() << " ";
for(int i = 0 ; b.size() > i ; i++)
cout << b[i] << " ";
lin
}
else
{
ll n;
cin >> n;
ll a[n];
ll x = 0;
ll A = 0 , B = 0;
for(int i = 0 ; n>i ; i++)
{
cin >> a[i];
if(a[i]!=1&&a[i]!=2)
x++;
}
for(int i = 0 ; n>i ; i++)
{
if(a[i]==1)
A++;
else if(a[i]==2)
B+=2;
}
if(x==1)
B+=a[n-1]*10;
else if(x==2)
A+=a[n-1]*10+a[n-2]*10;
else if(x)
{
if(abs(a[n-1]-a[n-2])<=1)
{
A+=10*(a[n-1]+a[n-2]);
B+=10*a[n-3];
}
else
{
A+=10*(a[n-2]+a[n-3]);
B+=10*(a[n-1]);
}
}
if(B>=A)
cout << "B\n";
else
cout << "A\n";
}
}
}
Compilation message (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... |