Submission #376132

# Submission time Handle Problem Language Result Execution time Memory
376132 2021-03-11T01:30:10 Z daniel920712 Lamps (JOI19_lamps) C++14
0 / 100
4 ms 1772 KB
#include <iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;
char a[200005];
char b[200005];
int main()
{
    int N,M,ans=0,i;
    scanf("%d",&N);
    scanf("%s %s",a,b);
    for(i=0;i<N;i++)
    {
        if(b[i]=='1'&&(i==0||b[i-1]=='0')) ans++;
    }
    printf("%d\n",ans);
    return 0;
}

Compilation message

lamp.cpp: In function 'int main()':
lamp.cpp:10:11: warning: unused variable 'M' [-Wunused-variable]
   10 |     int N,M,ans=0,i;
      |           ^
lamp.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   11 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~
lamp.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |     scanf("%s %s",a,b);
      |     ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Runtime error 4 ms 1772 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -