제출 #1121274

#제출 시각아이디문제언어결과실행 시간메모리
1121274HduongJust Long Neckties (JOI20_ho_t1)C++17
9 / 100
1051 ms10068 KiB
#include <bits/stdc++.h>
#define task "task"

using namespace std;
const int N = 2e5 + 5;
long long a[N], n, b[N];
pair <long long, long long> pi[N];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  if (fopen (task".inp", "r")) {
    freopen (task".inp", "r", stdin);
    freopen (task".out", "w", stdout);
  }

  cin >> n;
  for (int i = 1; i <= n + 1; i++) {
    cin >> a[i];
    pi[i].first = a[i];
    pi[i].second = i;
  }
  for (int i = 1; i <= n; i++) cin >> b[i];
  sort(b + 1, b + n + 1);
  sort(pi + 1, pi + n + 2);
  for (int i = 1; i <= n + 1; i++) {
    long long res = 0, id = 1;
    for (int j = 1; j <= n + 1; j++) {
      if (pi[j].second == i) continue ;
//      cout << pi[j].second << " ";
      res = max(res, max(pi[j].first - b[id++], 0ll));
    }
//    cout << "\n";
    cout << res << " ";
  }
}

컴파일 시 표준 에러 (stderr) 메시지

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:14:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     freopen (task".inp", "r", stdin);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
ho_t1.cpp:15:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     freopen (task".out", "w", stdout);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...