fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int x, max, n;
  6. cin>>n;
  7. cin>>x; cout<<x<<" "; max=x;
  8. while(cin>>x){
  9. if(x>max)
  10. max=x;
  11. cout<<max<<" ";
  12. }
  13. return 0;
  14. }
Success #stdin #stdout 0s 5572KB
stdin
12
4 6 3 7 8 1 6 2 7 9 10 8
stdout
4 6 6 7 8 8 8 8 8 9 10 10