제출 #204214

#제출 시각아이디문제언어결과실행 시간메모리
204214Segtree팀들 (IOI15_teams)C++14
0 / 100
121 ms24548 KiB
#include"teams.h" #include<iostream> #include<algorithm> #include<vector> #include<queue> using namespace std; typedef long long ll; typedef pair<ll,ll> P; #define chmin(a,b) a=min(a,b) #define chmax(a,b) a=max(a,b) #define rep(i,n) for(int i=0;i<n;i++) #define mod 1000000007 #define mad(a,b) a=(a+b)%mod #define NS 110 vector<P> v; int dat[NS]; void init(int N,int A[],int B[]){ rep(i,N)v.push_back(make_pair(B[i],A[i])); sort(v.begin(),v.end()); rep(i,NS)dat[i]=0; } void add(int K){ rep(i,v.size()){ if(v[i].second<=K&&dat[i]==0)dat[i]=1; } } void erase(int n){ for(int i=0;i<=n;i++){ if(dat[i]==1)dat[i]=2; } } int sum(int n){ ll res=0; for(int i=0;i<=n;i++){ res+=(dat[i]==1); } return res; } int can(int M,int K[]){ sort(K,K+M); rep(i,M){ add(K[i]); ll l,r,mid; l=-1,r=v.size(); while(l<r-1){ mid=(l+r)>>1; (v[mid].first<K[i]?l:r)=mid; } erase(l); l=-1,r=v.size(); while(l<r-1){ mid=(l+r)>>1; (sum(mid)>=K[i]?r:l)=mid; } if(r==v.size())return 0; erase(r); } rep(i,NS)dat[i]=0; return 1; } /* int main(){ int n,a[110],b[110]; cin>>n; rep(i,n)cin>>a[i]>>b[i]; init(n,a,b); while(1){ int m,k[110]; cin>>m; rep(i,m)cin>>k[i]; cout<<(can(m,k)?"YES":"NO")<<endl; } }*/

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

teams.cpp: In function 'void add(int)':
teams.cpp:11:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,n) for(int i=0;i<n;i++)
teams.cpp:25:6:
  rep(i,v.size()){
      ~~~~~~~~~~                
teams.cpp:25:2: note: in expansion of macro 'rep'
  rep(i,v.size()){
  ^~~
teams.cpp: In function 'int sum(int)':
teams.cpp:39:9: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return res;
         ^~~
teams.cpp: In function 'int can(int, int*)':
teams.cpp:52:10: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
   erase(l);
          ^
teams.cpp:56:12: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
    (sum(mid)>=K[i]?r:l)=mid;
            ^
teams.cpp:58:7: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(r==v.size())return 0;
      ~^~~~~~~~~~
teams.cpp:59:10: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
   erase(r);
          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...