제출 #261321

#제출 시각아이디문제언어결과실행 시간메모리
261321NightlightArcade (NOI20_arcade)C++14
100 / 100
291 ms16544 KiB
#include <bits/stdc++.h>
#define pii pair<int, int>
using namespace std;

int N;
int P[500005], T[500005];
pii A[500005];
vector<int> LIS;

int main() {
  scanf("%d %d", &N, &N);
  for(int i = 1; i <= N; i++) scanf("%d", &T[i]);
  for(int i = 1; i <= N; i++) {
    scanf("%d", &P[i]);
    A[i] = make_pair(T[i] + P[i], -(N - (T[i] - P[i])));
  }
  sort(A + 1, A + N + 1);
  LIS.emplace_back(-A[1].second);
  for(int i = 2; i <= N; i++) {
    A[i].second = -A[i].second;
    int pos = lower_bound(LIS.begin(), LIS.end(), A[i].second) - LIS.begin();
    if(pos == LIS.size()) LIS.emplace_back(A[i].second);
    else LIS[pos] = A[i].second;
  }
  cout << LIS.size() << "\n";
  cin >> N;
}

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

Arcade.cpp: In function 'int main()':
Arcade.cpp:22:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(pos == LIS.size()) LIS.emplace_back(A[i].second);
        ~~~~^~~~~~~~~~~~~
Arcade.cpp:11:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &N, &N);
   ~~~~~^~~~~~~~~~~~~~~~~
Arcade.cpp:12:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for(int i = 1; i <= N; i++) scanf("%d", &T[i]);
                               ~~~~~^~~~~~~~~~~~~
Arcade.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &P[i]);
     ~~~~~^~~~~~~~~~~~~
#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...