Please read the new rule regarding the restriction on the use of AI tools. ×

NonGrammer's blog

By NonGrammer, 12 years ago, In Russian

Хей Пишу сверхпростой код:

#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <stdio.h>
#include <math.h>
#include <fstream>
#include <algorithm>
//#include <cstdio>

using namespace std;

int main(){
    int m[100000];
    int n=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>m[i];
    }
    int k;
    cin>>k;
    for(int i=0;i<k;i++){
        int w,h;
        cin>>w>>h;
        int mx=0;
        for(int j=0;j<w;j++){
            if(m[j]>mx){
                mx=m[j];
            }
        }
        std::cout<<mx<<"\n";
        for(int j=0;j<w;j++){
            m[j]=mx+h;
        }
    }
    return 0;
}

И почему-то TL на 13ом претесте

хотя тут только k 10^9 ~~~~~ for(int j=0;j<w;j++){ if(m[j]>mx){ mx=m[j]; } } std::cout<<mx<<"\n"; for(int j=0;j<w;j++){ m[j]=mx+h; } ~~~~~

вестьма небольшие

Почему?

  • Vote: I like it
  • -44
  • Vote: I do not like it