제출 #1312496

#제출 시각아이디문제언어결과실행 시간메모리
1312496MunkhturErdenebat축제 (IOI25_festival)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#include<string.h>
#include <algorithm>
#include <iterator>
#include <set>
#include <stdlib.h>
 #define ll long long
 #define fr first
 #define sc second
 #define pb push_back
 #define YES cout<<"YES"<<endl
 #define NO cout<<"NO"<<endl
using namespace std;
    ll a,b,c,d,e,f,m,i,j,n,h,g,r,ka,q[351105],maa[200005];
    map<ll,ll> mee,see;
    map<ll,ll> mii;
    vector<ll> vas,vis,vii;
    string x,y,z,te,to;
    vector<pair<ll,ll>> ves[50];
    
    pair<ll,ll> wefe;
    priority_queue<ll> pq1,pq2;
    stack<ll> munkh;
    ll l[5],r[5];
void check(ll b){
    ll c=0;
    for(j=4 ; j>=0 ; j--){
        if(c>0){
            check(b);
            break;
        }
        for(ll i=l[j] ; i<ves[j].size() ; i++){
            if((b-ves[j][i].fr)*j>=b){
                c++;
                vas.pb(ves[j][i].sc);
                l[j]++;
                check(b);
            }
            else{
                break;
            }
        }
    }
    if(c==0){
        return ;
    }
}
vector<ll> max_coupons(ll b, vector<ll> k, vector<ll> t) {
    a=k.size();
	for(i=0 ; i<a ; i++){
	    ves[t[i]].pb({k[i],i+1});
	}
	for(i=0 ; i<=4 ; i++){
	    sort(ves[i].begin(),ves[i].end());
	    r[i]=ves[i].size();
	}
	for(i=0 ; i<ves[3].size() ; i++){
	    cout<<ves[3][i].fr<<" "<<ves[3][i].sc<<endl;
	}
	l[1]=0;
	l[2]=0;
	l[3]=0;
	l[4]=0;
	l[0]=0;
	check(b);
  return vas;
}

컴파일 시 표준 에러 (stderr) 메시지

festival.cpp:24:13: error: conflicting declaration 'long long int r [5]'
   24 |     ll l[5],r[5];
      |             ^
festival.cpp:14:32: note: previous declaration as 'long long int r'
   14 |     ll a,b,c,d,e,f,m,i,j,n,h,g,r,ka,q[351105],maa[200005];
      |                                ^
festival.cpp: In function 'std::vector<long long int> max_coupons(long long int, std::vector<long long int>, std::vector<long long int>)':
festival.cpp:55:14: error: invalid types 'long long int[long long int]' for array subscript
   55 |             r[i]=ves[i].size();
      |              ^