제출 #1098925

#제출 시각아이디문제언어결과실행 시간메모리
1098925alexander_707070팀들 (IOI15_teams)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "teams.h" #define MAXN 500007 using namespace std; struct interval{ int l,r; inline friend bool operator < (interval fr,interval sc){ return fr.r>sc.r; } }s[MAXN]; bool cmp(interval fr,interval sc){ return fr.l<sc.l; } priority_queue<interval> q; int n,m,a[MAXN],b[MAXN],k[MAXN]; void init(int N, int A[], int B[]) { //void init(int N, vector<int> A, vector<int> B) { n=N; for(int i=1;i<=n;i++){ a[i]=A[i-1]; b[i]=B[i-1]; } } int can(int M,int K[]) { //int can(int M,vector<int> K) { m=M; for(int i=1;i<=m;i++){ k[i]=K[i-1]; } sort(k+1,k+m+1); for(int i=1;i<=n;i++){ int l=0,r=k+1,tt; while(l+1<r){ tt=(l+r)/2; if(k[tt]<=b[i]){ l=tt; }else{ r=tt; } } s[i].r=l; l=0; r=k+1; while(l+1<r){ tt=(l+r)/2; if(k[tt]>=a[i]){ r=tt; }else{ l=tt; } } s[i].l=r; } sort(s+1,s+n+1,cmp); while(!q.empty())q.pop(); int pt=1; for(int i=1;i<=m;i++){ while(pt<=n and s[pt].l<=k[i]){ q.push(s[pt]); pt++; } while(!q.empty() and q.top().r<k[i])q.pop(); for(int f=0;f<k[i];f++){ if(q.empty())return 0; q.pop(); } } return 1; } /*int main(){ init(4,{1,2,2,2},{2,3,3,4}); cout<<can(2,{1,3})<<"\n"; cout<<can(2,{1,1})<<"\n"; return 0; }*/

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:41:20: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   41 |         int l=0,r=k+1,tt;
      |                   ~^~
      |                    |
      |                    int*
teams.cpp:53:17: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   53 |         l=0; r=k+1;
      |                ~^~
      |                 |
      |                 int*