QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#523949 | #8832. Daily Disinfection | SocialPanda | WA | 3ms | 3744kb | C++23 | 1.5kb | 2024-08-19 01:23:09 | 2024-08-19 01:23:10 |
Judging History
answer
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
//#define int long long
//#define LL long long
#define double long double
//#define lf Lf
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define PII pair<int,int>
#define Gheap priority_queue<int,vector<int>,greater<int>>
#define Lheap priority_queue<int>
#define MAXN 0x3f3f3f3f
#define MINN -0x3f3f3f3f
using namespace std;
//const int N=1e6+100,M=2*N;
//int e[N],w[M],h[M],ne[M],idx;
void solve()
{
int n;cin>>n;
char a[n+1];
unordered_map<int,int> st;
st[0]=st[n+1]=1;
int ans=0;
for(int i=1;i<=n;i++)
{
cin>>a[i];
if(a[i]=='1')
{
//if(st[i+1]==1 and st[i-1]==1)
//{
// ans+=2;
//}
//else
//{
// ans++;
// if(st[i-1]==0) st[i-1]=1;
// else if(st[i+1]==0) st[i+1]=1;
//}
ans++;
}
}
for(int i=1;i<=n-5;i++)
{
if(a[i]=='1' and a[i+1]=='0' and a[i+2]=='1' and a[i+3]=='0' and a[i+4]=='1')
{
ans++;
break;
}
}
cout<<ans<<endl;
}
int main()
{
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int tt=1,cnt=0;
cin >> tt;
while(tt--)
{
cnt++;
if(cnt==15)
{
int num;
cin>>num;
string s;
cin>>s;
cout<<s<<endl;
}
solve();
}
}
/*
1000101111
101010101
01111
110101111
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3744kb
input:
3 2 01 5 00110 9 101010101
output:
1 2 6
result:
ok 3 number(s): "1 2 6"
Test #2:
score: -100
Wrong Answer
time: 3ms
memory: 3532kb
input:
10000 15 010111111011011 10 1000101111 10 0011111101 1 0 3 110 4 1000 8 10000111 20 00000101000100001110 13 1101110110110 13 0111100011010 17 00001001111110101 1 0 20 10001010011000111100 11 00100110101 11 10110101000 15 001011110011000 16 1110111110000111 15 011110110110010 1 0 20 10110001101100010...
output:
11 6 7 0 2 1 4 6 9 7 9 0 9 5 10110101000 7 11 9 0 9 9 7 3 6 0 6 2 5 4 8 10 4 6 1 8 2 1 8 1 8 12 10 13 4 11 14 16 7 3 4 5 1 1 7 7 5 3 0 0 12 8 5 7 7 6 4 10 1 4 5 13 0 2 11 3 3 8 7 3 7 4 3 7 10 15 2 6 6 10 8 6 1 2 4 2 11 11 5 0 0 4 8 4 7 0 4 8 9 3 3 10 3 7 11 8 1 7 6 5 2 4 9 7 1 5 7 9 3 5 11 6 10 8 8 ...
result:
wrong answer 15th numbers differ - expected: '5', found: '10110101000'