QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#96342 | #2921. Land Equality | mostafa_ayman# | WA | 2ms | 3432kb | C++14 | 2.0kb | 2023-04-13 19:56:42 | 2023-04-13 19:56:46 |
Judging History
answer
#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define int ll
typedef tree<
pair<int, int>,
null_type,
less<pair<int, int>>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;//order_of_key()->gives how many elements less than specific element in the set ,, find_by_order() ->find specific element by index the set
#define ll long long
#define el '\n'
#define IO \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl '\n'
using namespace std;
int const N = 2e6 +5 ;
void megz(int n){
deque<int>dq (1,1) ;
while (n--){
int rem = 0 ;
int num = 0 ;
for (int i = dq.size()-1 ; i>=0 ;i--){
num = dq[i]*2+rem;
dq[i] = num%10 ;
rem = num/10 ;
}
// cout <<dq.size()<<endl ;
if (rem)dq.push_front(1);
}
for (auto x : dq){
cout <<x ;
}
cout <<endl;
}
signed main() {
// IO
int n,m;
cin>>n>>m;
int zeroes=0,towes=0,ones=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
int x;
cin>>x;
if(x==0)
zeroes++;
else if(x==2)
towes++;
else
ones++;
}
}
if(zeroes>=2)
{
cout<<0;
}
else if(zeroes==1&&towes>=1&&ones>=1)
{
cout<<1;
}
else if(zeroes==1&&towes==0)
{
cout<<1;
}
else if(zeroes==1&&towes>=1)
{
cout<<2;
}
else if(zeroes==0)
{
if(towes%2==0)
cout<<0;
else
{
// long double x= pow(2,towes/2);// cout<<(ll)x;
megz(towes/2) ;
}
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 3316kb
input:
1 2 0 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3300kb
input:
1 2 0 2
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3352kb
input:
1 2 1 2
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3432kb
input:
2 1 1 1
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3348kb
input:
2 1 0 0
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3308kb
input:
5 5 2 2 2 2 2 2 2 1 2 2 2 1 1 1 2 2 2 1 2 2 2 2 2 2 2
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3332kb
input:
5 5 2 2 2 2 2 2 2 1 2 2 2 1 1 1 2 2 2 1 1 2 2 2 2 2 2
output:
512
result:
ok single line: '512'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
2 3 0 1 2 1 1 2
output:
1
result:
ok single line: '1'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3324kb
input:
2 6 0 2 2 1 2 2 1 1 1 1 2 2
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3328kb
input:
4 4 2 2 2 2 2 1 2 2 2 0 2 2 2 2 2 2
output:
1
result:
ok single line: '1'
Test #11:
score: -100
Wrong Answer
time: 1ms
memory: 3352kb
input:
1 3 0 1 2
output:
1
result:
wrong answer 1st lines differ - expected: '2', found: '1'