답안 #84401

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
84401 2018-11-15T06:57:01 Z hamzqq9 학교 설립 (IZhO13_school) C++14
25 / 100
140 ms 9420 KB
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)>>1)
#define all(x) x.begin(),x.end()
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define pw(x) (1<<(x))
#define inf 2005000
#define MOD 1000000007
#define N 300005
#define M 1000005
#define LOG 18
#define KOK 4000000
using namespace std;

int se[N],n,a,b,x[N],y[N];
priority_queue<iii> dif;
ll ans;

int main() {

//	freopen("input.txt","r",stdin);	

	scanf("%d %d %d",&n,&a,&b);

	for(int i=1;i<=n;i++) {

		scanf("%d %d",&x[i],&y[i]);

		dif.push({{y[i]-x[i],x[i]},i});

		ans+=x[i];

	}

	for(int i=1;i<=b;i++) {

		iii x=dif.top();

		dif.pop();

		ans+=x.st.st;

		se[x.nd]=1;

	}

	priority_queue<int> q;

	for(int i=1;i<=n;i++) {

		if(se[i]) continue ;

		q.push(-x[i]);

	}

	for(int i=1;i<=n-a-b;i++) {

		ans-=-q.top();

		q.pop();

	}

	printf("%lld",ans);

}

Compilation message

school.cpp: In function 'int main()':
school.cpp:34:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d",&n,&a,&b);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~
school.cpp:38:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&x[i],&y[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Incorrect 2 ms 512 KB Output isn't correct
5 Incorrect 2 ms 512 KB Output isn't correct
6 Incorrect 2 ms 640 KB Output isn't correct
7 Incorrect 4 ms 640 KB Output isn't correct
8 Correct 3 ms 640 KB Output is correct
9 Incorrect 3 ms 676 KB Output isn't correct
10 Incorrect 4 ms 676 KB Output isn't correct
11 Incorrect 5 ms 744 KB Output isn't correct
12 Incorrect 4 ms 744 KB Output isn't correct
13 Incorrect 14 ms 1700 KB Output isn't correct
14 Incorrect 38 ms 2852 KB Output isn't correct
15 Incorrect 77 ms 6064 KB Output isn't correct
16 Correct 91 ms 6064 KB Output is correct
17 Incorrect 130 ms 6604 KB Output isn't correct
18 Incorrect 108 ms 7884 KB Output isn't correct
19 Incorrect 117 ms 8356 KB Output isn't correct
20 Incorrect 140 ms 9420 KB Output isn't correct