답안 #84457

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
84457 2018-11-15T08:32:35 Z hamzqq9 학교 설립 (IZhO13_school) C++14
25 / 100
157 ms 7468 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 2005000000
#define MOD 1000000007
#define N 300005
#define M 1000005
#define LOG 18
#define KOK 4000000
using namespace std;

int n,m,s,x[N],y[N];
ll ans;
priority_queue<int> q2;
priority_queue<ii> q;

int main() {

	//freopen("input.txt","r",stdin);
	
	scanf("%d %d %d",&n,&m,&s);

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

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

		ans+=x[i];

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

	}

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

		ans+=q.top().st;

		q2.push(q.top().nd);

		q.pop();

	}

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

		ans+=q2.top();

		q2.pop();

	}

	printf("%lld",ans);

}

Compilation message

school.cpp: In function 'int main()':
school.cpp:35:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d",&n,&m,&s);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~
school.cpp:39: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 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 456 KB Output is correct
4 Incorrect 2 ms 536 KB Output isn't correct
5 Incorrect 2 ms 616 KB Output isn't correct
6 Incorrect 2 ms 872 KB Output isn't correct
7 Incorrect 4 ms 872 KB Output isn't correct
8 Correct 4 ms 872 KB Output is correct
9 Incorrect 4 ms 872 KB Output isn't correct
10 Incorrect 4 ms 872 KB Output isn't correct
11 Incorrect 4 ms 928 KB Output isn't correct
12 Incorrect 4 ms 928 KB Output isn't correct
13 Incorrect 14 ms 1732 KB Output isn't correct
14 Incorrect 66 ms 2652 KB Output isn't correct
15 Incorrect 97 ms 4768 KB Output isn't correct
16 Correct 95 ms 5164 KB Output is correct
17 Incorrect 103 ms 5664 KB Output isn't correct
18 Incorrect 130 ms 6016 KB Output isn't correct
19 Incorrect 123 ms 6444 KB Output isn't correct
20 Incorrect 157 ms 7468 KB Output isn't correct