Submission #743068

# Submission time Handle Problem Language Result Execution time Memory
743068 2023-05-17T07:44:43 Z vjudge1 Lightning Rod (NOI18_lightningrod) C++17
4 / 100
1667 ms 304 KB
#include<bits/stdc++.h>
using namespace std;

#define iii tuple<int,int,int>
int n;
int cnt = 0;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    int recent;
    cnt = n;
    for(int i=1;i<=n;++i)
    {
        int x,y;
        cin >> x >> y;
        if(y == 1 && recent == 0) --cnt;
        if(y == 0 && recent == 1) --cnt;
        recent = y;
    }
    cout << cnt;
    return 0;
}

Compilation message

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:17:19: warning: 'recent' may be used uninitialized in this function [-Wmaybe-uninitialized]
   17 |         if(y == 1 && recent == 0) --cnt;
      |            ~~~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1423 ms 304 KB Output is correct
2 Correct 1404 ms 304 KB Output is correct
3 Correct 1474 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1667 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1423 ms 304 KB Output is correct
2 Correct 1404 ms 304 KB Output is correct
3 Correct 1474 ms 296 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -