Official

A - chmin Editorial by en_translator


For beginners

To fulfill the problem statement’s requirement, we need to do the following:

  • Process \(i=1,2,\dots,N\) in order.
  • Make a comparison to determine if \(A_i < X\).

The former can be done with a for loop, and the latter can be done with an if loop.

Sample code (C++):

#include<bits/stdc++.h>

using namespace std;

int main(){
  int n,x;
  cin >> n >> x;
  for(int i=1;i<=n;i++){
    int a;
    cin >> a;
    if(a<x){
      x=a;
      cout << "1\n";
    }
    else{
      cout << "0\n";
    }
  }
  return 0;
}

posted:
last update: