Submission #2600747
Source Code Expand
#include<stdio.h> #include<vector> #include<algorithm> #include<set> using namespace std; typedef long long ll; ll fxs[55]; vector<ll>mvs[101010]; #define INF 1012023034045056067LL ll per, len, fx, mv, gen; multiset<ll>se; ll cnt = 0; ll getscore(ll a, ll b) { if (a == b)return 0; if (b - a <= gen + 1)return b - a - 1; else return 0; } void rem(ll t) { multiset<ll>::iterator it = se.find(t); it--; ll a = *it; it++; ll b = *it; it++; ll c = *it; it--; cnt -= getscore(a, b); cnt -= getscore(b, c); cnt += getscore(a, c); se.erase(it); if (se.find(b) == se.end())cnt--; } void add(ll t) { multiset<ll>::iterator it = se.lower_bound(t); ll b = *it; it--; ll a = *it; cnt += getscore(a, t); cnt += getscore(t, b); cnt -= getscore(a, b); if (se.find(t) == se.end())cnt++; se.insert(t); } int main() { scanf("%lld%lld%lld%lld%lld", &per, &len, &fx, &mv, &gen); for (int i = 0; i < fx; i++)scanf("%lld", &fxs[i]), fxs[i]--, se.insert(fxs[i]); for (int i = 0; i < mv; i++) { ll za, zb; scanf("%lld%lld", &za, &zb); za--, zb--; mvs[zb].push_back(za); se.insert(za*len + zb); } se.insert(-INF); se.insert(INF); multiset<ll>::iterator it = se.begin(); ll bef = *it; for (;;) { it++; if ((*it) == INF)break; ll t = (*it) - bef; bef = *it; if (t <= gen + 1)cnt += t; else cnt++; } for (int i = 0; i < len; i++) { printf("%lld\n", cnt); for (int j = 0; j < mvs[i].size(); j++)rem(mvs[i][j] * len + i), add((mvs[i][j] + 1)*len + i); for (int j = 0; j < fx; j++)rem(fxs[j] + i), add(fxs[j] + i + 1); } }
Submission Info
Submission Time | |
---|---|
Task | E - 祝日 |
User | DEGwer |
Language | C++14 (GCC 5.4.1) |
Score | 700 |
Code Size | 1636 Byte |
Status | AC |
Exec Time | 3442 ms |
Memory | 12032 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:49:59: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld%lld%lld%lld%lld", &per, &len, &fx, &mv, &gen); ^ ./Main.cpp:50:81: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] for (int i = 0; i < fx; i++)scanf("%lld", &fxs[i]), fxs[i]--, se.insert(fxs[i]); ^ ./Main.cpp:54:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld%lld", &za, &zb); ^
Judge Result
Set Name | Sample | Subtask1 | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 600 / 600 | 100 / 100 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt |
Subtask1 | 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, sample-01.txt, sample-02.txt |
All | 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 02-13.txt, 02-14.txt, 02-15.txt, 02-16.txt, 02-17.txt, 02-18.txt, 02-19.txt, 02-20.txt, 02-21.txt, 02-22.txt, 02-23.txt, 02-24.txt, 02-25.txt, 02-26.txt, 02-27.txt, 02-28.txt, 02-29.txt, 02-30.txt, 02-31.txt, 02-32.txt, sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 170 ms | 10880 KB |
01-02.txt | AC | 159 ms | 9984 KB |
01-03.txt | AC | 98 ms | 8192 KB |
01-04.txt | AC | 32 ms | 4480 KB |
01-05.txt | AC | 145 ms | 8832 KB |
01-06.txt | AC | 138 ms | 8320 KB |
01-07.txt | AC | 133 ms | 8048 KB |
01-08.txt | AC | 23 ms | 4608 KB |
01-09.txt | AC | 179 ms | 9600 KB |
01-10.txt | AC | 26 ms | 4096 KB |
01-11.txt | AC | 126 ms | 9856 KB |
01-12.txt | AC | 131 ms | 9600 KB |
01-13.txt | AC | 140 ms | 9856 KB |
01-14.txt | AC | 53 ms | 6016 KB |
01-15.txt | AC | 150 ms | 9216 KB |
01-16.txt | AC | 5 ms | 2688 KB |
01-17.txt | AC | 34 ms | 4352 KB |
01-18.txt | AC | 163 ms | 8320 KB |
01-19.txt | AC | 167 ms | 10880 KB |
01-20.txt | AC | 161 ms | 10112 KB |
02-01.txt | AC | 1414 ms | 12032 KB |
02-02.txt | AC | 476 ms | 9216 KB |
02-03.txt | AC | 588 ms | 10112 KB |
02-04.txt | AC | 1057 ms | 10240 KB |
02-05.txt | AC | 1542 ms | 10752 KB |
02-06.txt | AC | 780 ms | 9344 KB |
02-07.txt | AC | 133 ms | 8048 KB |
02-08.txt | AC | 294 ms | 3584 KB |
02-09.txt | AC | 1240 ms | 11676 KB |
02-10.txt | AC | 86 ms | 3968 KB |
02-11.txt | AC | 1346 ms | 10624 KB |
02-12.txt | AC | 381 ms | 9472 KB |
02-13.txt | AC | 518 ms | 9216 KB |
02-14.txt | AC | 98 ms | 3712 KB |
02-15.txt | AC | 376 ms | 9088 KB |
02-16.txt | AC | 35 ms | 2688 KB |
02-17.txt | AC | 64 ms | 4480 KB |
02-18.txt | AC | 198 ms | 8448 KB |
02-19.txt | AC | 1594 ms | 10880 KB |
02-20.txt | AC | 132 ms | 8052 KB |
02-21.txt | AC | 344 ms | 3328 KB |
02-22.txt | AC | 3 ms | 2560 KB |
02-23.txt | AC | 3442 ms | 11136 KB |
02-24.txt | AC | 1801 ms | 9216 KB |
02-25.txt | AC | 1052 ms | 9216 KB |
02-26.txt | AC | 4 ms | 2560 KB |
02-27.txt | AC | 82 ms | 2688 KB |
02-28.txt | AC | 315 ms | 2944 KB |
02-29.txt | AC | 156 ms | 8064 KB |
02-30.txt | AC | 158 ms | 8192 KB |
02-31.txt | AC | 158 ms | 8192 KB |
02-32.txt | AC | 210 ms | 2816 KB |
sample-01.txt | AC | 2 ms | 2560 KB |
sample-02.txt | AC | 2 ms | 2560 KB |
sample-03.txt | AC | 3 ms | 2560 KB |
sample-04.txt | AC | 2 ms | 2560 KB |