Please sign in first.
Submission #6627220
Source Code Expand
// Sample Code
// G Subtask3
// Writen by gotoloop
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
signed main() {
int n, m;
cin >> n >> m;
assert(1 <= n && n <= 1000000000);
assert(0 <= m && m <= 1000);
int p, q, r, s;
cin >> p >> q >> r >> s;
assert(1 <= p && p <= n);
assert(1 <= q && q <= n);
assert(1 <= r && r <= n);
assert(1 <= s && s <= n);
assert(p == 1 && r == 1);
vector<int> t(m), a(m), b(m), c(m), d(m);
rep(i, m) {
cin >> t[i] >> a[i] >> b[i] >> c[i] >> d[i];
assert(t[i] == 1 || t[i] == 2);
if(t[i] == 1) {
assert(1 <= a[i] && a[i] <= b[i] && b[i] <= n);
assert(1 <= c[i] && c[i] < d[i] && d[i] <= n);
}
else {
assert(1 <= a[i] && a[i] < b[i] && b[i] <= n);
assert(1 <= c[i] && c[i] <= d[i] && d[i] <= n);
}
assert(t[i] == 1);
assert(a[i] == 1 && b[i] == 1);
}
map<int, int> table;
rep(i, m) {
table[c[i]]++;
table[d[i]]--;
}
int mi = min(q, s);
int ma = max(q, s);
int ans = ma - mi;
int now = 0;
int pre = 0;
for(auto i: table) {
if(now > 0) {
if(i.first <= mi || ma <= pre) {}
else if(pre <= mi) {
if(i.first <= ma) {
ans -= i.first - mi;
}
else {
ans = 0;
}
}
else {
if(i.first <= ma) {
ans -= i.first - pre;
}
else {
ans -= ma - pre;
}
}
}
now += i.second;
pre = i.first;
}
cout << ans << endl;
}
Submission Info
| Submission Time | |
|---|---|
| Task | G - 空をかけるピ太郎 (Pitaro, who Leaps through Air) |
| User | goto |
| Language | C++14 (GCC 5.4.1) |
| Score | 25 |
| Code Size | 1498 Byte |
| Status | RE |
| Exec Time | 103 ms |
| Memory | 384 KiB |
Judge Result
| Set Name | Sample 1 | Sample 2 | Sample 3 | Subtask 1 | Subtask 2 | Subtask 3 | Subtask 4 | Subtask 5 | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 0 | 0 / 0 | 0 / 4 | 12 / 12 | 13 / 13 | 0 / 18 | 0 / 53 | ||||||||||||||||||||||
| Status |
|
|
|
|
|
|
|
|
| Set Name | Test Cases |
|---|---|
| Sample 1 | sample-01.txt |
| Sample 2 | sample-02.txt |
| Sample 3 | sample-03.txt |
| Subtask 1 | sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt |
| Subtask 2 | sample-03.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt |
| Subtask 3 | sample-02.txt, sample-03.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 03-01.txt, 03-02.txt, 03-03.txt, 03-04.txt, 03-05.txt, 03-06.txt |
| Subtask 4 | sample-01.txt, sample-02.txt, sample-03.txt, 04-01.txt, 04-02.txt, 04-03.txt, 04-04.txt, 04-05.txt, 04-06.txt, 04-07.txt, 04-08.txt, 04-09.txt, 04-10.txt, 04-11.txt, 04-12.txt, 04-13.txt, 04-14.txt, 04-15.txt |
| Subtask 5 | sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 03-01.txt, 03-02.txt, 03-03.txt, 03-04.txt, 03-05.txt, 03-06.txt, 04-01.txt, 04-02.txt, 04-03.txt, 04-04.txt, 04-05.txt, 04-06.txt, 04-07.txt, 04-08.txt, 04-09.txt, 04-10.txt, 04-11.txt, 04-12.txt, 04-13.txt, 04-14.txt, 04-15.txt, 05-01.txt, 05-02.txt, 05-03.txt, 05-04.txt, 05-05.txt, 05-06.txt, 05-07.txt, 05-08.txt, 05-09.txt, 05-10.txt, 05-11.txt, 05-12.txt, 05-13.txt, 05-14.txt, 05-15.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01-01.txt | AC | 1 ms | 256 KiB |
| 01-02.txt | AC | 1 ms | 256 KiB |
| 01-03.txt | RE | 100 ms | 256 KiB |
| 01-04.txt | RE | 100 ms | 256 KiB |
| 01-05.txt | RE | 100 ms | 256 KiB |
| 01-06.txt | RE | 99 ms | 256 KiB |
| 02-01.txt | AC | 1 ms | 256 KiB |
| 02-02.txt | AC | 1 ms | 256 KiB |
| 02-03.txt | AC | 1 ms | 256 KiB |
| 02-04.txt | AC | 2 ms | 256 KiB |
| 02-05.txt | AC | 3 ms | 384 KiB |
| 02-06.txt | AC | 3 ms | 384 KiB |
| 03-01.txt | AC | 1 ms | 256 KiB |
| 03-02.txt | AC | 1 ms | 256 KiB |
| 03-03.txt | AC | 1 ms | 256 KiB |
| 03-04.txt | AC | 3 ms | 384 KiB |
| 03-05.txt | AC | 3 ms | 384 KiB |
| 03-06.txt | AC | 3 ms | 384 KiB |
| 04-01.txt | RE | 100 ms | 256 KiB |
| 04-02.txt | RE | 99 ms | 256 KiB |
| 04-03.txt | RE | 100 ms | 256 KiB |
| 04-04.txt | RE | 99 ms | 256 KiB |
| 04-05.txt | RE | 100 ms | 256 KiB |
| 04-06.txt | RE | 99 ms | 256 KiB |
| 04-07.txt | RE | 99 ms | 256 KiB |
| 04-08.txt | RE | 99 ms | 256 KiB |
| 04-09.txt | RE | 98 ms | 256 KiB |
| 04-10.txt | RE | 97 ms | 256 KiB |
| 04-11.txt | RE | 98 ms | 256 KiB |
| 04-12.txt | RE | 98 ms | 256 KiB |
| 04-13.txt | RE | 99 ms | 256 KiB |
| 04-14.txt | RE | 98 ms | 256 KiB |
| 04-15.txt | RE | 98 ms | 256 KiB |
| 05-01.txt | RE | 97 ms | 256 KiB |
| 05-02.txt | RE | 97 ms | 256 KiB |
| 05-03.txt | RE | 98 ms | 256 KiB |
| 05-04.txt | RE | 97 ms | 256 KiB |
| 05-05.txt | RE | 97 ms | 256 KiB |
| 05-06.txt | RE | 100 ms | 256 KiB |
| 05-07.txt | RE | 103 ms | 256 KiB |
| 05-08.txt | RE | 102 ms | 256 KiB |
| 05-09.txt | RE | 100 ms | 256 KiB |
| 05-10.txt | RE | 100 ms | 256 KiB |
| 05-11.txt | RE | 99 ms | 256 KiB |
| 05-12.txt | RE | 99 ms | 256 KiB |
| 05-13.txt | RE | 100 ms | 256 KiB |
| 05-14.txt | RE | 100 ms | 256 KiB |
| 05-15.txt | RE | 99 ms | 256 KiB |
| sample-01.txt | RE | 99 ms | 256 KiB |
| sample-02.txt | AC | 1 ms | 256 KiB |
| sample-03.txt | AC | 1 ms | 256 KiB |