## Submission #473119

# Submission time Handle Problem Language Result Execution time Memory
473119 2021-09-15T08:14:40 Z SaraMostafa Košnja (COCI17_kosnja) C++14
50 / 50
15 ms 588 KB
```#include <bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define endl "\n"
#define Sara ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const long long mod=1e9+7;
const double PI=acos(-1);
// 1 2 3 --> 1,2,3 ...1,2..1,3..1..2,3..2..3..none (2 power number of elements)
//1 2 3 --> 2--> 1,2..1,3..2,3..(!n/(r!(n-r)!)) aka:ncr
// 1 2 3 -->2-->1,2..2,1..1,3..3,1..2,3..3,2..(n!/(n-r)!) aka:npr
//1 2 3--> 1..1,2..1,2,3..2..2,3..3  number of subarrays -->(n*(n+1))/2 "sum of numbers from 1 to n."
/*
ll power(ll x,ll y)
{
if(y==0)
return 1;
else if(y==1)
return x%mod;
ll  r=power(x%mod,((y%mod)/2)%mod);
if(y%2==0)
return ((r%mod)*(r%mod));
else
return ((r%mod)*(r%mod)*(x%mod));
}

ll inverse(ll md,ll x)
{
return power(x%mod,mod-2);
}

*/
int main()
{
//freopen("input.in","r",stdin);

Sara

int k;
cin>>k;
for(int i=0;i<k;i++){
ll n,m;
cin>>n>>m;
ll r=0,c=0;
if(n==1 || m==1) cout<<0<<endl;
else{
r=n-2;
r=2*r;
r+=2;
c=m-2;
c=2*c;
c+=2;
cout<<min(c,r)<<endl;

}
}
return 0;
}

```

#### Subtask #1 50.0 / 50.0

# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 10 ms 460 KB Output is correct
7 Correct 15 ms 564 KB Output is correct
8 Correct 10 ms 472 KB Output is correct
9 Correct 14 ms 588 KB Output is correct
10 Correct 10 ms 440 KB Output is correct