제출 #1179414

#제출 시각아이디문제언어결과실행 시간메모리
1179414alwaus424Liteh and Newfiteh (INOI20_litehfiteh)C++20
0 / 100
0 ms320 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fr(m) for(int i = 0; i < m; i++)
#define fro(m) for(int i=1; i<m; i++)
#define _ "\n"
#define nll cout<<'\n'
#define ff first
#define ss second
#define inff (1<<30)
#define srt(m) sort(m.begin(),m.end())
#define srtr(m) sort(m.rbegin(),m.rend())
#define rev(m) reverse(m.begin(),m.end())

void solve() {
    int n; cin >> n;
    vector<int>v(n);
    fr(n) {
        cin >> v[i];
        if(v[i ] == 0) {
            cout <<"-1";
            return;
        }
    }
    ll cnt = 1;
    ll cur = v[0];
    fr(n){
        if(v[i] != cur){
            cur = v[i];
            cnt++;
        }
            // cout << i << " "<<cnt;
            // nll;
     }
    cout << cnt;
    nll;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    // int t; cin >> t;
    // while (t--) 
        solve();

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...