제출 #492202

#제출 시각아이디문제언어결과실행 시간메모리
492202MalheirosBitaro’s Party (JOI18_bitaro)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
 
using namespace std;
 
#define ld long double
#define ll long long
//#define int ll
#define FF first.first
#define FS first.second
#define SF second.first
#define SS second.second
#define PB push_back
#define MP make_pair
#define all(cont) cont.begin(),cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define FOR(i, j) for(int i=0;i<j;i++)
#define RFOR(i, j) for (int i=j;i>=0;i--)
#define GO cin.tie(NULL);
#define FAST ios_base::sync_with_stdio(false);
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()
 
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<pii> VPII;
typedef vector<VI> VVI;
typedef priority_queue<int> max_heap;
typedef priority_queue<pii> max_heapii;
typedef priority_queue<int,VI,greater<int>> min_heap;
typedef priority_queue<pii,VPII,greater<pii>> min_heapii;
 
const long double PI = 3.14159265359;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll randint(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}
 
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
    cout << vars << " = ";
    string delim = "";
    (..., (cout << delim << values, delim = ", "));
    cout<<endl;
}
 
void print(vector<int>v){
	cout<<"[";
	FOR(i,v.size()){
		cout<<v[i];
		if(i+1!=v.size())cout<<", ";
	}
	cout<<"]"<<endl;
}
 
void print(pii p){
	cout<<"{"<<p.first<<", "<<p.second<<"}"<<endl;
}

const int maxn=1e5+10;
const int magic=0;

VI grafo[maxn];
vector<pair<VI,int>> light[maxn];
vector<pair<set<int>,int>> heavy[maxn];
int ans[maxn];

VI caches[maxn];
int n,m,q;
void solvelight(){
  
}
int dist[maxn];

void solveheavy(int u){
  //deb(u);
  FOR(i,u+1)dist[i]=0;
  //memset(dist,0,sizeof(dist));
  for(int i=u;i>=0;i--){
     for(auto k:grafo[i])dist[k]=max(dist[k],dist[i]+1);
  }
 /* FOR(i,u+1){
     cout<<dist[i]<<' ';
  }
  cout<<endl;*/
}

void solveheavy(int u,const pair<unordered_set<int>,int> &cara){
 // deb(u,);

  int maior=0;
  for(int i=u;i>=0;i--){
    if(cara.first.find(i)==cara.first.end())maior=max(maior,dist[i]);
  }
  ans[cara.second]=maior;
}

void solveheavy(){
  FOR(i,n){
    if(!heavy[i].empty()){
      solveheavy(i);
      for(auto& k:heavy[i]){
        solveheavy(i,k);
      }
    }
  }
}

signed main(){
  GO FAST

  cin>>n>>m>>q;

  FOR(i,m){
    int a,b;cin>>a>>b;a--;b--;
    grafo[b].PB(a);
  }
  FOR(i,q){
    int f,k;
    cin>>f>>k;
    f--;

    if (k>=magic){
      set<int> sett;
      FOR(j,k){
        int a;cin>>a;a--;
        sett.insert(a);
      }
      heavy[f].PB(MP(sett,i));
    }
    else{
      VI v(k);
      FOR(j,k){
        cin>>v[j];
        v[j]--;
      }
      light[f].PB(MP(v,i));
    }
  }
  solvelight();
  solveheavy();
  FOR(i,q){
    cout<<ans[i]<<'\n';
  }
}

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

bitaro.cpp: In function 'void print(std::vector<int>)':
bitaro.cpp:16:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 | #define FOR(i, j) for(int i=0;i<j;i++)
......
   47 |  FOR(i,v.size()){
      |      ~~~~~~~~~~                 
bitaro.cpp:47:2: note: in expansion of macro 'FOR'
   47 |  FOR(i,v.size()){
      |  ^~~
bitaro.cpp:49:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |   if(i+1!=v.size())cout<<", ";
      |      ~~~^~~~~~~~~~
bitaro.cpp: In function 'void solveheavy()':
bitaro.cpp:101:23: error: no matching function for call to 'solveheavy(int&, std::pair<std::set<int>, int>&)'
  101 |         solveheavy(i,k);
      |                       ^
bitaro.cpp:73:6: note: candidate: 'void solveheavy(int)'
   73 | void solveheavy(int u){
      |      ^~~~~~~~~~
bitaro.cpp:73:6: note:   candidate expects 1 argument, 2 provided
bitaro.cpp:86:6: note: candidate: 'void solveheavy(int, const std::pair<std::unordered_set<int>, int>&)'
   86 | void solveheavy(int u,const pair<unordered_set<int>,int> &cara){
      |      ^~~~~~~~~~
bitaro.cpp:86:59: note:   no known conversion for argument 2 from 'std::pair<std::set<int>, int>' to 'const std::pair<std::unordered_set<int>, int>&'
   86 | void solveheavy(int u,const pair<unordered_set<int>,int> &cara){
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
bitaro.cpp:96:6: note: candidate: 'void solveheavy()'
   96 | void solveheavy(){
      |      ^~~~~~~~~~
bitaro.cpp:96:6: note:   candidate expects 0 arguments, 2 provided