답안 #865023

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
865023 2023-10-24T02:22:20 Z guagua0407 Lamps (JOI19_lamps) C++17
4 / 100
4 ms 4524 KB
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

void setIO(string s) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}

int main() {_
    int n;
    cin>>n;
    string a,b;
    cin>>a>>b;
    int cnt=0;
    int ans=0;
    for(int i=0;i<n;i++){
        if(b[i]=='0'){
            if(cnt>0) ans++;
            cnt=0;
        }
        else{
            cnt++;
        }
    }
    if(cnt>0) ans++;
    cout<<ans<<'\n';
    return 0;
}
//maybe its multiset not set

Compilation message

lamp.cpp: In function 'void setIO(std::string)':
lamp.cpp:12:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     freopen((s + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lamp.cpp:13:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     freopen((s + ".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 460 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 4 ms 4344 KB Output is correct
8 Correct 4 ms 4408 KB Output is correct
9 Correct 4 ms 4524 KB Output is correct
10 Correct 4 ms 4376 KB Output is correct
11 Correct 4 ms 4340 KB Output is correct
12 Correct 4 ms 4508 KB Output is correct
13 Correct 4 ms 4344 KB Output is correct
14 Correct 4 ms 4344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -