QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#115456 | #6628. Flip it and Stick it | mikefeng# | 4 | 2ms | 4144kb | C++17 | 2.2kb | 2023-06-26 09:45:15 | 2024-05-31 14:13:35 |
Judging History
answer
bool M1;
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<iomanip>
#include<cassert>
#include<random>
#include<cstdio>
#include<vector>
#include<bitset>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<ctime>
#include<map>
#include<set>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/hash_policy.hpp>
//#include<ext/pb_ds/priority_queue.hpp>
#define fi first
#define se second
#define LD double
#define name(x) #x
#define ll long long
#define Vector Point
#define I128 __int128
#define ull unsigned ll
#define pii pair<int,int>
#define pb(x) push_back(x)
#define dek(x) debug(x)<<" "
#define deh(x) debug(x)<<endl
#define syt cerr<<"sytakioi\n"
#define debug(x) cout<<name(x)<<":"<<x
#define F(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)
#define look_memory cerr<<abs(&M2-&M1)/1024.0/1024<<'\n'
#define rd_i(l,r) uniform_int_distribution<int>(l,r)(rd)
#define rd_r(l,r) uniform_real_distribution<double>(l,r)(rd)
#define look_time cerr<<(clock()-Time)*1.0/CLOCKS_PER_SEC<<'\n'
using namespace std;
//using namespace __gnu_cxx;
mt19937 rd(time(0));
int num0,num1;
string s,t;
namespace sub1{
inline void mian(){
F(i,0,s.size()-1) if(s[i]==t[0]) return void(cout<<"-1\n");
cout<<"0\n";
}
}
namespace sub2{
inline void solve1(){
int num=0;
F(i,1,s.size()-1) if(s[i]=='1'&&s[i-1]=='0') ++num;
cout<<num<<'\n';
}
inline void solve2(){
int num=0;
F(i,0,s.size()-1) num+=s[i]-'0';
if(num<s.size()/2) return void(cout<<"-1");
}
inline void mian(){
if(t[0]=='1'){
t[0]^=1;t[1]^=1;
F(i,0,s.size()-1) s[i]^=1;
}
if(t[0]!=t[1]) solve1();
else solve2();
}
}
namespace sub3{
inline void mian(){
}
}
bool M2;
int main(){
int Time=clock();
look_memory;
cin.tie(nullptr)->sync_with_stdio(false);
cin>>s>>t;
if(s.size()<t.size()) return cout<<"0\n",0;
F(i,0,t.size()-1)
if(t[i]=='0') ++num0;
else ++num1;
if(num1>num0){
F(i,0,t.size()-1) t[i]^=1;
F(i,0,s.size()-1) s[i]^=1;
}
if(t.size()==1) sub1::mian();
else if(t.size()==2) sub2::mian();
else sub3::mian();
look_time;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 1
Accepted
Test #1:
score: 1
Accepted
time: 1ms
memory: 3996kb
input:
1 0
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 1
Accepted
time: 1ms
memory: 3956kb
input:
1 1
output:
-1
result:
ok 1 number(s): "-1"
Test #3:
score: 1
Accepted
time: 1ms
memory: 4084kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
-1
result:
ok 1 number(s): "-1"
Test #4:
score: 1
Accepted
time: 1ms
memory: 4124kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
0
result:
ok 1 number(s): "0"
Test #5:
score: 1
Accepted
time: 1ms
memory: 4128kb
input:
101001000011101010101001001010010110111111001100110001111101111110110110101011111010001101111001101101010111101100000110001110001100000101111100000110111110001010101101101110001000011010000101000110110010110110100001110001111001010000000010000000101000000100110011101110100111111101111111111110010101...
output:
-1
result:
ok 1 number(s): "-1"
Test #6:
score: 1
Accepted
time: 1ms
memory: 4136kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #7:
score: 1
Accepted
time: 1ms
memory: 4080kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
-1
result:
ok 1 number(s): "-1"
Subtask #2:
score: 3
Accepted
Test #8:
score: 3
Accepted
time: 1ms
memory: 4036kb
input:
0 01
output:
0
result:
ok 1 number(s): "0"
Test #9:
score: 3
Accepted
time: 0ms
memory: 4008kb
input:
0 10
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 3
Accepted
time: 1ms
memory: 4008kb
input:
01 01
output:
1
result:
ok 1 number(s): "1"
Test #11:
score: 3
Accepted
time: 1ms
memory: 3996kb
input:
01 10
output:
0
result:
ok 1 number(s): "0"
Test #12:
score: 3
Accepted
time: 0ms
memory: 4008kb
input:
1010101010 10
output:
5
result:
ok 1 number(s): "5"
Test #13:
score: 3
Accepted
time: 1ms
memory: 4128kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #14:
score: 3
Accepted
time: 1ms
memory: 4144kb
input:
100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #15:
score: 3
Accepted
time: 1ms
memory: 4128kb
input:
010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
output:
100000
result:
ok 1 number(s): "100000"
Test #16:
score: 3
Accepted
time: 2ms
memory: 4132kb
input:
000110111001011000010001010010010000010100100000011101010000001000110011100000011011100101110110000001000000000011001010001101001110011111001101110010001100000000010000000100100011000111010011100110011101100011000100011001010000010001001010010101100000100000010010110000000001011100100001000010100100...
output:
43860
result:
ok 1 number(s): "43860"
Test #17:
score: 3
Accepted
time: 2ms
memory: 4056kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
44072
result:
ok 1 number(s): "44072"
Subtask #3:
score: 0
Wrong Answer
Dependency #2:
100%
Accepted
Test #18:
score: 4
Accepted
time: 0ms
memory: 4000kb
input:
0 01
output:
0
result:
ok 1 number(s): "0"
Test #19:
score: 4
Accepted
time: 0ms
memory: 4036kb
input:
0 10
output:
0
result:
ok 1 number(s): "0"
Test #20:
score: 4
Accepted
time: 1ms
memory: 4040kb
input:
01 01
output:
1
result:
ok 1 number(s): "1"
Test #21:
score: 4
Accepted
time: 0ms
memory: 4008kb
input:
01 10
output:
0
result:
ok 1 number(s): "0"
Test #22:
score: 4
Accepted
time: 0ms
memory: 3924kb
input:
1 00
output:
0
result:
ok 1 number(s): "0"
Test #23:
score: 4
Accepted
time: 0ms
memory: 4012kb
input:
1 11
output:
0
result:
ok 1 number(s): "0"
Test #24:
score: 0
Wrong Answer
time: 0ms
memory: 3948kb
input:
10 00
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Subtask #4:
score: 0
Wrong Answer
Test #40:
score: 5
Accepted
time: 0ms
memory: 3924kb
input:
11 011
output:
0
result:
ok 1 number(s): "0"
Test #41:
score: 5
Accepted
time: 1ms
memory: 4000kb
input:
0 110
output:
0
result:
ok 1 number(s): "0"
Test #42:
score: 5
Accepted
time: 1ms
memory: 4004kb
input:
01 100
output:
0
result:
ok 1 number(s): "0"
Test #43:
score: 0
Wrong Answer
time: 0ms
memory: 3864kb
input:
110 110
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Subtask #5:
score: 0
Wrong Answer
Test #53:
score: 5
Accepted
time: 0ms
memory: 4016kb
input:
11 011
output:
0
result:
ok 1 number(s): "0"
Test #54:
score: 5
Accepted
time: 0ms
memory: 3996kb
input:
01 100
output:
0
result:
ok 1 number(s): "0"
Test #55:
score: 0
Wrong Answer
time: 0ms
memory: 4000kb
input:
011 011
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Subtask #6:
score: 0
Skipped
Dependency #4:
0%