제출 #1226449

#제출 시각아이디문제언어결과실행 시간메모리
1226449chaeryeongArcade (NOI20_arcade)C++20
0 / 100
1 ms320 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; /* t[j] - t[i] >= abs(a[i] - a[j]) t[j] - t[i] >= a[i] - a[j] and t[j] - t[i] >= a[j] - a[i] t[j] + a[j] >= t[i] + a[i] and t[j] - a[j] >= t[i] - a[i] */ const int M = 5e5 + 25; int n, m; array <ll, 2> a[M]; void solve () { cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> a[i][0]; } for (int i = 1; i <= m; i++) { cin >> a[i][1]; } sort(a + 1, a + m + 1); for (int i = 1; i <= m; i++) { a[i] = {a[i][0] - a[i][1], a[i][0] + a[i][1]}; } vector <array <ll, 2>> ee; for (int i = 1; i <= m; i++) { bool flag = 0; //cout << a[i][0] << " " << a[i][1] << '\n'; int pos = -1; int c = 0; for (auto j : ee) { if (j[0] <= a[i][0] && j[1] <= a[i][1]) { if (pos == -1 || j[0] > a[pos][0]) { pos = c; } } c++; } if (pos == -1) { ee.push_back(a[i]); } else { ee[c] = a[i]; } } cout << (int)ee.size() << '\n'; } signed main () { #ifndef ONLINE_JUDGE freopen("input_file", "r", stdin); freopen("output_file", "w", stdout); #endif ios::sync_with_stdio(0); cin.tie(0); int tc = 1; //cin >> tc; while (tc--) solve(); }

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

Arcade.cpp: In function 'int main()':
Arcade.cpp:50:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   50 |                 freopen("input_file", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Arcade.cpp:51:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |                 freopen("output_file", "w", stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...