답안 #89032

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
89032 2018-12-10T08:40:08 Z Lkvatashidze 학교 설립 (IZhO13_school) C++17
10 / 100
463 ms 19324 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;

   multiset < pair < int, pair < int, int > > > x;


 int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

     int n, m, s;
      cin >> n >> m >> s;

      for (int k=1; k<=n; k++) {
         int f, s;
         cin >> f >> s;
         x.insert({-(f+s),{f,s}});
      }

          ll ans=0;

      while (!x.empty()) {
        pair < int, pair < int, int > > f=(*x.begin());
        x.erase(x.begin());
        if (f.second.first>=f.second.second & m) {
            m--;
            ans+=f.second.first;
            continue;
        }
        if (f.second.first<=f.second.second && s) {
            s--;
            ans+=f.second.second;
            continue;
        }
        if (s) {
            s--;
            ans+=f.second.second;
            continue;
        }
        if (m) {
            m--;
            ans+=f.second.first;
            continue;
        }
        break;
    }

      cout << ans;

    return 0;
}

Compilation message

school.cpp: In function 'int main()':
school.cpp:28:27: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
         if (f.second.first>=f.second.second & m) {
             ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 584 KB Output is correct
4 Incorrect 0 ms 584 KB Output isn't correct
5 Incorrect 3 ms 584 KB Output isn't correct
6 Incorrect 2 ms 680 KB Output isn't correct
7 Incorrect 6 ms 828 KB Output isn't correct
8 Incorrect 5 ms 836 KB Output isn't correct
9 Incorrect 4 ms 964 KB Output isn't correct
10 Incorrect 4 ms 964 KB Output isn't correct
11 Incorrect 4 ms 964 KB Output isn't correct
12 Incorrect 4 ms 964 KB Output isn't correct
13 Incorrect 24 ms 2772 KB Output isn't correct
14 Incorrect 58 ms 5460 KB Output isn't correct
15 Incorrect 136 ms 10452 KB Output isn't correct
16 Incorrect 166 ms 11844 KB Output isn't correct
17 Incorrect 284 ms 14332 KB Output isn't correct
18 Incorrect 349 ms 15740 KB Output isn't correct
19 Incorrect 356 ms 16844 KB Output isn't correct
20 Incorrect 463 ms 19324 KB Output isn't correct