Submission #1300776

#TimeUsernameProblemLanguageResultExecution timeMemory
1300776nataliaa장애물 (IOI25_obstacles)C++20
Compilation error
0 ms0 KiB
//#include "obstacles.h"
#include<bits/stdc++.h>
using namespace std;
bool t;
int n, m;
vector<int> t;
void initialize(vector<int> T, vector<int> H){
     n = T.size(), m = H.size(); 
     for(int i = 1; i <n; i++ ) {
         if(T[i]<T[i-1]) {
             t = false; break;
         }
     }
    for(int i = 0; i <m; i++){
        if(T[n-1]<=H[i]) f[i+1]++;
    }
    for(int i = 1; i < m; i++){
        f[i+1]+=f[i];
    }
}
bool can_reach(int l, int r, int s, int d){
    if(s==d) return true;
    if(s>d) swap(s,d);
    if(f[d]-f[s]==0) return true;
    return false;
}

Compilation message (stderr)

obstacles.cpp:6:13: error: conflicting declaration 'std::vector<int> t'
    6 | vector<int> t;
      |             ^
obstacles.cpp:4:6: note: previous declaration as 'bool t'
    4 | bool t;
      |      ^
obstacles.cpp: In function 'void initialize(std::vector<int>, std::vector<int>)':
obstacles.cpp:15:26: error: 'f' was not declared in this scope
   15 |         if(T[n-1]<=H[i]) f[i+1]++;
      |                          ^
obstacles.cpp:18:9: error: 'f' was not declared in this scope
   18 |         f[i+1]+=f[i];
      |         ^
obstacles.cpp: In function 'bool can_reach(int, int, int, int)':
obstacles.cpp:24:8: error: 'f' was not declared in this scope
   24 |     if(f[d]-f[s]==0) return true;
      |        ^