답안 #840163

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
840163 2023-08-31T07:38:24 Z TsotneSV Exam (eJOI20_exam) C++17
12 / 100
20 ms 1228 KB
#pragma gcc diagnostic "-std=c++1z"
#include <bits/stdc++.h>
using namespace std;
/* /\_/\
  (= ._.)
  / >  \>
*/
//#define int long long

#define fi first
#define se second
#define pb push_back
#define ins insert
#define mp make_pair
#define endl "\n"
#define sz(x) (int) (x).size()
#define deb(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<" "<<x<<endl

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

const ll inf=1e9;
const ll INF=1e18;
const ll mod=998244353;
const ll MOD=1e9+7;
const ll MAXN=1e5+5;

int n,A[MAXN],B[MAXN];

void solve(){
    cin>>n; 

    for(int i=1;i<=n;i++) cin>>A[i];

    for(int i=1;i<=n;i++) cin>>B[i];

    int cnt = 0,ans = 0; bool flag = 0;

    for(int i=1;i<=n;i++) {
        if(A[i] > B[i]) {
            ans += cnt * flag;
            cnt = flag = 0;
            continue;
        }
        if(A[i] == B[i]) flag = 1;
        cnt++;
    } ans += cnt * flag;
    deb(ans);
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    int tt=1;
  //  cin>>tt;
    while(tt--){
        solve();
    }
}

Compilation message

exam.cpp:1: warning: ignoring '#pragma gcc diagnostic' [-Wunknown-pragmas]
    1 | #pragma gcc diagnostic "-std=c++1z"
      |
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 6 ms 468 KB Output is correct
3 Correct 12 ms 1076 KB Output is correct
4 Correct 8 ms 1128 KB Output is correct
5 Correct 18 ms 1100 KB Output is correct
6 Correct 9 ms 1104 KB Output is correct
7 Correct 10 ms 1108 KB Output is correct
8 Correct 20 ms 1228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -