Submission #834287

# Submission time Handle Problem Language Result Execution time Memory
834287 2023-08-22T12:38:56 Z HollaFoil Arcade (NOI20_arcade) C++14
0 / 100
0 ms 212 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> times(m);
    vector<int> locations(m);
    vector<pair<int, int>> rotated(m);
    for (int i = 0; i < m; i++) cin >> times[i];
    for (int i = 0; i < m; i++) cin >> locations[i];
    for (int i = 0; i < m; i++) rotated[i] = make_pair(times[i]+locations[i], times[i]-locations[i]);

    sort(rotated.begin(), rotated.end());
    vector<int> antichain;
    for (int i = 0; i < m; i++) {
        auto it = upper_bound(antichain.begin(), antichain.end(), rotated[i].second);
        int offset = (int)(it-antichain.begin());
		if (offset == antichain.size()) antichain.push_back(rotated[i].second);
		else antichain[offset] = rotated[i].second;
    }
    cout << antichain.size();
}

Compilation message

Arcade.cpp: In function 'int main()':
Arcade.cpp:19:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   if (offset == antichain.size()) antichain.push_back(rotated[i].second);
      |       ~~~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -