답안 #167006

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
167006 2019-12-05T07:54:04 Z itgl 학교 설립 (IZhO13_school) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#define ss second
#define pb push_back
#define mp make_pair
#define ff first

using namespace std;

freopen(school.in,"r",stdin);
freopen(school.out,"w",strout);

int n,m,s;
priority_queue<pair<int,int> > pq,pq1;
int main(){
  cin >> n >> m >> s;

  for(int i=1;i<=n;i++){
    int x,y;
    cin >> x >> y;
    pq.push(mp(x,x-y));
  }
  int res=0;
  while(!pq.empty()){
    if(m>0){
      if(pq.top().ss>0&&s<=0){
        res+=pq.top().ff;

        pq.pop();
        m--;
      }else if(s>0){
        pq1.push(mp(pq.top().ff-pq.top().ss,-pq.top().ss));
        pq.pop();
      }

    }
    else{
      pq1.push(mp(pq.top().ff-pq.top().ss,-pq.top().ss));
      pq.pop();
    }
  }
  while(!pq1.empty()){
    if(s>0){
      res+=pq1.top().ff;
      pq1.pop();
      s--;
    }
    else {
      pq.push(mp(pq1.top().ff-pq1.top().ss,-pq.top().ss));
      pq1.pop();
    }
  }
  while(m--){
    res+=pq.top().ff;
    pq.pop();
  }


  cout << res;

  return 0;
}

Compilation message

school.cpp:9:8: error: expected constructor, destructor, or type conversion before '(' token
 freopen(school.in,"r",stdin);
        ^
school.cpp:10:8: error: expected constructor, destructor, or type conversion before '(' token
 freopen(school.out,"w",strout);
        ^