답안 #149065

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149065 2019-09-01T05:40:14 Z 샌즈뼈(#3582, exqt, esselem) 십자가 놓기 (FXCUP4_cross) C++17
63 / 100
204 ms 11232 KB
#include "cross.h"
#include <bits/stdc++.h>
using namespace std;

long long SelectCross(int K, std::vector<int> I, std::vector<int> O) {
	int N = I.size();

  vector<pair<int, int>> v;
  for(int i=0; i<N; i++) v.emplace_back(O[i], I[i]);

  sort(v.rbegin(), v.rend());

  //for(int i=0;i <N; i++) cout << v[i].first << ' '; cout << endl;
  //for(int i=0;i <N; i++) cout << v[i].second << ' '; cout << endl;


  set<int> s;
  for(int i=0; i<K-1; i++) {
    s.insert(v[i].second);
  }

  long long res = 0;
  for(int i=K-1; i<N; i++) {
    if(s.size()+1 > K) s.erase(s.begin());
    s.insert(v[i].second);

    int r = v[i].first;
    int t = *(s.begin());

    //cout <<r << ' ' << t << endl;


    res = max(res, 1LL*r*r - 1LL*(r-t)*(r-t));
  }

	return res;
}

Compilation message

cross.cpp: In function 'long long int SelectCross(int, std::vector<int>, std::vector<int>)':
cross.cpp:24:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(s.size()+1 > K) s.erase(s.begin());
        ~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 14 ms 768 KB Output is correct
6 Correct 117 ms 5740 KB Output is correct
7 Correct 117 ms 5736 KB Output is correct
8 Correct 118 ms 5484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 14 ms 768 KB Output is correct
6 Correct 117 ms 5740 KB Output is correct
7 Correct 117 ms 5736 KB Output is correct
8 Correct 118 ms 5484 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 13 ms 768 KB Output is correct
13 Correct 62 ms 3184 KB Output is correct
14 Correct 121 ms 5768 KB Output is correct
15 Correct 117 ms 5740 KB Output is correct
16 Correct 119 ms 5736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 14 ms 768 KB Output is correct
6 Correct 117 ms 5740 KB Output is correct
7 Correct 117 ms 5736 KB Output is correct
8 Correct 118 ms 5484 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 13 ms 768 KB Output is correct
13 Correct 62 ms 3184 KB Output is correct
14 Correct 121 ms 5768 KB Output is correct
15 Correct 117 ms 5740 KB Output is correct
16 Correct 119 ms 5736 KB Output is correct
17 Correct 6 ms 428 KB Output is correct
18 Correct 7 ms 384 KB Output is correct
19 Correct 17 ms 1280 KB Output is correct
20 Correct 71 ms 3308 KB Output is correct
21 Correct 95 ms 4980 KB Output is correct
22 Correct 119 ms 5740 KB Output is correct
23 Correct 117 ms 5740 KB Output is correct
24 Correct 141 ms 6624 KB Output is correct
25 Incorrect 204 ms 11232 KB Output isn't correct
26 Halted 0 ms 0 KB -