QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#358242 | #407. Toilets | mkolko | 0 | 1ms | 3528kb | C++17 | 1.3kb | 2024-03-19 18:23:43 | 2024-03-19 18:23:44 |
answer
#include <iostream>
#include <vector>
using namespace std;
int dane[100'007];
vector<int> tab;
int fun(int n, vector<int> in)
{
int kob=in.size()-1, koe=in.size()-1;
for(int a=0; a<n; a++)
{
while(in[kob]==-1 || in[kob]==0)
kob--;
if(in[kob]==-69)
return 0;
in[kob]=-1;
//cout<<kob<<" ";
while(in[koe]==-1)
koe--;
if(in[koe]==-69)
return 0;
in[koe]=-1;
//cout<<koe<<"\n";
}
return 1;
}
int main()
{
string s;
int n, m, p, odp=0, suma=0;
cin>>n>>m>>s>>p;
for(int a=0; a<n*2; a++)
{
if(s[a]=='F'){
suma++;
dane[a]=1;
}
}
for(int a=20; a>=0; a--)
{
tab.clear();
tab.push_back(-69);
for(int i=0; i<n*2; i++)
{
if(dane[i]==1 || tab.size() >=i-2-odp-(1<<a))
tab.push_back(dane[i]);
}
for(int i=tab.size()-1; i<n*2; i++)
tab.push_back(0);
for(int i=0; i<tab.size(); i++)
cout<<tab[i]<<" ";
cout<<endl;
cout<<fun(n,tab)<<" "<<odp<<" "<<(1<<a)<<"|\n";
if(fun(n,tab)==0)
odp=odp+(1<<a);
}
cout<<odp;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3528kb
input:
10 1 FMFFFFFFMFFFMMMMMFMM 1
output:
-69 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 1048576| -69 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 524288| -69 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 262144| -69 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 131072| -69 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 65536| -69 1 1 1 1 1 1...
result:
wrong answer 1st lines differ - expected: '5', found: '-69 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 '
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%