Submission #376133

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

using namespace std;
char a[1000005];
char b[1000005];
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 Correct 9 ms 3692 KB Output is correct
8 Correct 12 ms 4204 KB Output is correct
9 Correct 10 ms 4332 KB Output is correct
10 Correct 10 ms 4204 KB Output is correct
11 Correct 10 ms 4204 KB Output is correct
12 Correct 10 ms 4204 KB Output is correct
13 Correct 10 ms 4204 KB Output is correct
14 Correct 10 ms 4204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -