Submission #1002851

# Submission time Handle Problem Language Result Execution time Memory
1002851 2024-06-19T20:39:39 Z gabistroeh Autobahn (COI21_autobahn) C++14
Compilation error
0 ms 0 KB
    #include<bits/stdc++.h>
    using namespace std;
     
    const int MAXN = 100010;
    int l[MAXN], r[MAXN], t[MAXN], mark[MAXN];
    int v[MAXN];
    int seg[4*MAXN], qtde[4*MAXN];

    int query(int pos, int ini, int fim, int l1, int r1){
        if(r1<ini || l1>fim) return 0;
        if(l1<=ini && r1>=fim) return seg[pos];
        int m = (ini+fim)/2;
        return query(1, ini, m, l1, r1) + query(1, m+1, fim, l1, r1);
    }

    coid update(int ini, int )

    void build(int pos, int ini, int fim){
        if(ini==fim){
            seg[pos] = v[ini];
            return;
        }
        int m = (ini+fim)/2;
        build(e, ini, m);
        build(d, m+1, fim);
        seg[pos] = seg[d] + seg[e];
    }

    void build2(int pos, int ini, int fim){
        if(ini==fim){
            seg[pos] = mark[ini];
            return;
        }
        int m = (ini+fim)/2;
        build(e, ini, m);
        build(d, m+1, fim);
        seg[pos] = min(seg[d], seg[e]);
    }
     
    int main(){
    	int n, k, x;
    	cin >> n >> k >> x;
    	for(int i=0; i<n; i++){
    		cin >> l[i] >> t[i] >> r[i];
    		mark[l[i]]++;
            mark[r[i]+1]--;
    	}
        for(int i=1; i<100001; i++) mark[i] = mark[i-1] + mark[i];
    	for(int i=0; i<n; i++){
    		int tam = r[i] - l[i] + 1;
    		if(t[i]>=tam) continue;
    		int pes = 0;
    		for(int j=l[i]+t[i]; j<=r[i]; j++){
    			if(mark[j]>=k){
    				v[j]++;
    			}
    		}
    	}
        build(1, 1, 1000);
    	//for(int i=1; i<10; i++) cout << v[i] << " ";
    	int resp = 0;
    	for(int i=1; i<=1000-x+1; i++){
    		int cur = query(1, 1, n, i, i+x-1);
            //cout << "de " << i << " ate " << i+x-1 << " deu " << cur << endl;
    		//if(cur>resp) cout << cur << endl;
    		resp = max(resp, cur);
    	}
    	cout << resp;
    }

Compilation message

autobahn.cpp:16:5: error: 'coid' does not name a type; did you mean 'void'?
   16 |     coid update(int ini, int )
      |     ^~~~
      |     void
autobahn.cpp: In function 'void build2(int, int, int)':
autobahn.cpp:35:15: error: 'e' was not declared in this scope
   35 |         build(e, ini, m);
      |               ^
autobahn.cpp:35:9: error: 'build' was not declared in this scope; did you mean 'build2'?
   35 |         build(e, ini, m);
      |         ^~~~~
      |         build2
autobahn.cpp:36:15: error: 'd' was not declared in this scope
   36 |         build(d, m+1, fim);
      |               ^
autobahn.cpp: In function 'int main()':
autobahn.cpp:52:11: warning: unused variable 'pes' [-Wunused-variable]
   52 |       int pes = 0;
      |           ^~~
autobahn.cpp:59:9: error: 'build' was not declared in this scope; did you mean 'build2'?
   59 |         build(1, 1, 1000);
      |         ^~~~~
      |         build2