Submission #236911

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2369112020-06-03 18:46:55DS007Coin Collecting (JOI19_ho_t4)C++14
100 / 100
100 ms14308 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int solveTestCase() {
int n;
cin >> n;
vector<pair<int, int>> up, down, up_, down_;
for (int i = 0; i < n * 2; i++) {
int x, y;
cin >> x >> y;
if (y <= 1)
down.emplace_back(x, y);
else
up.emplace_back(x, y);
}
sort(up.begin(), up.end());
sort(down.begin(), down.end());
int ans = 0;
for (int i = 1, p1 = 0, p2 = 0, i1 = 1, i2 = 1; i <= n; i++) {
while (p1 < up.size() && up[p1].first <= (i == n ? 1e9 : i))
up_.push_back(up[p1++]);
while (p2 < down.size() && down[p2].first <= (i == n ? 1e9 : i))
down_.push_back(down[p2++]);
while (i1 <= i && !up_.empty())
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

joi2019_ho_t4.cpp: In function 'long long int solveTestCase()':
joi2019_ho_t4.cpp:25:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while (p1 < up.size() && up[p1].first <= (i == n ? 1e9 : i))
                ~~~^~~~~~~~~~~
joi2019_ho_t4.cpp:27:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while (p2 < down.size() && down[p2].first <= (i == n ? 1e9 : i))
                ~~~^~~~~~~~~~~~~
joi2019_ho_t4.cpp:41:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...