Submission #1105685

# Submission time Handle Problem Language Result Execution time Memory
1105685 2024-10-27T10:31:41 Z andrewp Wall (IOI14_wall) C++14
8 / 100
3000 ms 18144 KB
//Dedicated to my love, ivaziva
#pragma GCC optimize("Ofast") 
#include <bits/stdc++.h> 
#include "wall.h"     
using namespace std;  
using ll=int64_t; 
using pii=pair<int,int>;
using pll=pair<int,int>;    
#define pb push_back
#define fi first
#define se second
#define mp make_pair 
#define ldb double
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()     
void rd(int&x){scanf("%i",&x);}
void rd(ll&x){scanf("%lld",&x);} 
void rd(char*x){scanf("%s",x);}
void rd(ldb&x){scanf("%lf",&x);}
void rd(string&x){scanf("%s",&x);}
int ri(){int x;rd(x);return x;}  
// #ifndef ONLINE_JUDGE
// #include "C:\Users\andre\Downloads\cpp-dump-0.7.0\cpp-dump-0.7.0\cpp-dump.hpp" 
// #define dbg(...) cpp_dump(__VA_ARGS__)
// #else
// #define dump(...)
// #endif  
template<typename T1,typename T2>void rd(pair<T1,T2>&x){rd(x.first);rd(x.second);}
template<typename T>void rd(vector<T>&x){for(T&i:x)rd(i);}
template<typename T,typename...A>void rd(T&x,A&...args){rd(x);rd(args...);}
template<typename T>void rd(){T x;rd(x);return x;} 
template<typename T>vector<T> rv(int n){vector<T> x(n);rd(x);return x;} 
void buildWall(int n,int q,int* op,int* left,int* right,int* height,int* finalHeight) { 
    for(int i=0;i<q;i++){ 
        // printf("? %d %d %d %d\n",i,left[i],right[i],height[i]);
        if(op[i]==1){
            for(int j=left[i];j<=right[i];j++){
                finalHeight[j]=max(finalHeight[j],height[i]);
            }
        }else{
            for(int j=left[i];j<=right[i];j++){
                finalHeight[j]=min(finalHeight[j],height[i]);
            }
        }
    } 
    // for(int i=0;i<n;i++){
    //     printf("%d ",finalHeight[i]);
    // }
    // printf("\n");
} 

Compilation message

wall.cpp: In function 'void rd(ll&)':
wall.cpp:17:25: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type 'll*' {aka 'long int*'} [-Wformat=]
   17 | void rd(ll&x){scanf("%lld",&x);}
      |                      ~~~^  ~~
      |                         |  |
      |                         |  ll* {aka long int*}
      |                         long long int*
      |                      %ld
wall.cpp: In function 'void rd(std::string&)':
wall.cpp:20:27: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} [-Wformat=]
   20 | void rd(string&x){scanf("%s",&x);}
      |                          ~^  ~~
      |                           |  |
      |                           |  std::string* {aka std::__cxx11::basic_string<char>*}
      |                           char*
wall.cpp: In function 'void rd(int&)':
wall.cpp:16:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 | void rd(int&x){scanf("%i",&x);}
      |                ~~~~~^~~~~~~~~
wall.cpp: In function 'void rd(ll&)':
wall.cpp:17:20: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 | void rd(ll&x){scanf("%lld",&x);}
      |               ~~~~~^~~~~~~~~~~
wall.cpp: In function 'void rd(char*)':
wall.cpp:18:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 | void rd(char*x){scanf("%s",x);}
      |                 ~~~~~^~~~~~~~
wall.cpp: In function 'void rd(double&)':
wall.cpp:19:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 | void rd(ldb&x){scanf("%lf",&x);}
      |                ~~~~~^~~~~~~~~~
wall.cpp: In function 'void rd(std::string&)':
wall.cpp:20:24: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 | void rd(string&x){scanf("%s",&x);}
      |                   ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 2 ms 336 KB Output is correct
4 Correct 14 ms 636 KB Output is correct
5 Correct 17 ms 592 KB Output is correct
6 Correct 20 ms 636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 85 ms 13896 KB Output is correct
3 Correct 882 ms 7536 KB Output is correct
4 Execution timed out 3066 ms 18144 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 1 ms 496 KB Output is correct
4 Correct 14 ms 640 KB Output is correct
5 Correct 14 ms 636 KB Output is correct
6 Correct 21 ms 592 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 82 ms 13896 KB Output is correct
9 Correct 876 ms 7476 KB Output is correct
10 Execution timed out 3071 ms 18048 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 14 ms 592 KB Output is correct
5 Correct 14 ms 592 KB Output is correct
6 Correct 14 ms 592 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 93 ms 14004 KB Output is correct
9 Correct 901 ms 7572 KB Output is correct
10 Execution timed out 3053 ms 18020 KB Time limit exceeded
11 Halted 0 ms 0 KB -