QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#673372 | #5038. City | Gourab_Biswas# | AC ✓ | 2ms | 3744kb | C++20 | 2.5kb | 2024-10-24 21:59:06 | 2024-10-24 21:59:07 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef tree<
ll,
null_type,
less_equal<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define db double
#define pii pair<ll,ll>
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fi(i,a,b,c) for(ll i=a;i<b;i+=c)
#define fr(i,a,b) for(ll i=a;i>=b;i--)
#define fri(i,a,b,c) for(ll i=a;i>=b;i-=c)
#define pb push_back
#define ss second
#define ff first
#define in insert
#define sq(x) (x*x)
#define all(a) a.begin(),a.end()
#define nl '\n'
#define npii pair<ll,pair<ll,ll>>
#define mnpq priority_queue <npii, vector<npii>, greater<npii> >
ll gcd(ll a,ll b){
if(b==0)return a;
return gcd(b,a%b);
}
int getRandom(int L,int R)
{
return rng()%(R-L+1) + L;
}
ll lcm(ll a,ll b){
return ((a)/gcd(a,b))*b;
}
ll bigmod(ll a,ll n,ll md){
if(n==0){
return 1;
}
if(n==1){
return a%md;
}
ll d= bigmod(a,n/2,md);
if(n%2==0){
return (d*d)%md;
}
else{
return ( ((d*d)%md) * (a%md) )%md;
}
}
bool sortbysec(const pair<int,int> &a,
const pair<int,int> &b)
{
if(a.first==b.first){
return (a.second > b.second);
}
return (a.first< b.first);
}
const ll N = 200004;
const ll mod = 1e9 + 7;
const ll neginf= -1e18;
const ll inf = 1e18;
const ld eps= 1e-9;
/// avoid Wrong answer
/// think 2 minute before submission
/// check input output before submission
///use binary search for maximum minimum problem
ll sqr(ll d){
return d*d;
}
void solve(){
ll n,m;
cin>>n>>m;
n++;
m++;
ll an=0;
f(i,0,n){
f(j,0,m){
//right
ll rt=m-1-j;
ll dw=n-1-i;
ll a= rt/2;
ll b= dw/2;
an+=((a+1)*(b+1)-1);
ll c= rt/2;
ll d= i/2;
ll add=0;
add+=((c+1)*(d+1))-1-(c+d);
an+=add;
// cout<<i<<" "<<j<<" "<<add<<endl;
}
}
cout<<an;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll t=1;
// cin>>t;
while(t--){
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3744kb
input:
1 1
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
2 3
output:
14
result:
ok 1 number(s): "14"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
252 139
output:
156806790
result:
ok 1 number(s): "156806790"
Test #4:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
96 859
output:
869912790
result:
ok 1 number(s): "869912790"
Test #5:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
237 987
output:
6911470020
result:
ok 1 number(s): "6911470020"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
81 411
output:
142652940
result:
ok 1 number(s): "142652940"
Test #7:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
221 539
output:
1796341860
result:
ok 1 number(s): "1796341860"
Test #8:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
770 259
output:
5022934670
result:
ok 1 number(s): "5022934670"
Test #9:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
422 387
output:
3367022678
result:
ok 1 number(s): "3367022678"
Test #10:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
563 515
output:
10586725560
result:
ok 1 number(s): "10586725560"
Test #11:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
407 939
output:
18385757040
result:
ok 1 number(s): "18385757040"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
518 518
output:
9069351200
result:
ok 1 number(s): "9069351200"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
171 646
output:
1547964138
result:
ok 1 number(s): "1547964138"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
311 70
output:
61339980
result:
ok 1 number(s): "61339980"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
155 494
output:
745330482
result:
ok 1 number(s): "745330482"
Test #16:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
704 918
output:
52470835129
result:
ok 1 number(s): "52470835129"
Test #17:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
844 46
output:
197229825
result:
ok 1 number(s): "197229825"
Test #18:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
688 174
output:
1817294209
result:
ok 1 number(s): "1817294209"
Test #19:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
637 894
output:
40756317888
result:
ok 1 number(s): "40756317888"
Test #20:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
481 22
output:
15385922
result:
ok 1 number(s): "15385922"
Test #21:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
1 2
output:
2
result:
ok 1 number(s): "2"
Test #22:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
1 1000
output:
500000
result:
ok 1 number(s): "500000"
Test #23:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
1000 1000
output:
125500500000
result:
ok 1 number(s): "125500500000"
Test #24:
score: 0
Accepted
time: 2ms
memory: 3688kb
input:
999 1000
output:
125249749500
result:
ok 1 number(s): "125249749500"
Test #25:
score: 0
Accepted
time: 1ms
memory: 3540kb
input:
1000 999
output:
125249749500
result:
ok 1 number(s): "125249749500"
Test #26:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
999 999
output:
124999500000
result:
ok 1 number(s): "124999500000"
Test #27:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
998 999
output:
124749750500
result:
ok 1 number(s): "124749750500"
Test #28:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2 1
output:
2
result:
ok 1 number(s): "2"
Test #29:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
2 2
output:
8
result:
ok 1 number(s): "8"
Test #30:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
2 1000
output:
1251001
result:
ok 1 number(s): "1251001"