Submission #2309371
Source Code Expand
#define _USE_MATH_DEFINES #include <stdio.h> #include <iostream> #include <algorithm> #include <cmath> #include <string> #include <utility> #include <climits> #include <vector> #include <map> #include <queue> #include <set> using namespace std; #define ll long long const int MOD = 1000000007;//10^9+7 const string SPACE = " "; ll powsur(ll a, ll b, ll p) { if (b == 0) { return 1; } else if (b % 2 == 0) { ll d = powsur(a, b / 2, p); return ((d%p)*(d%p)) % p; } else { return ((a%p)*powsur(a, b - 1, p) % p) % p; } } //pは素数,aのb乗をpで割った余り ll CMOD(ll n, ll r, ll p) { ll a = 1, b = 1, c = 1, re; for (int i = 1; i <= n; i++) { a *= i; a = a%p; } for (int i = 1; i <= r; i++) { b *= i; b = b%p; } for (int i = 1; i <= n - r; i++) { c *= i; c = c%p; } b = powsur(b, p - 2, p); c = powsur(c, p - 2, p); re = ((a%p)*(b%p)) % p; re = ((re%p)*c%p) % p; return re; } //pは素数,(nCr)%p ll gcd(ll a, ll b) { if (a > b) { ll tmp = a; a = b; b = tmp; } ll r; r = b%a; if (r == 0)return a; else return gcd(r, a); } //最大公約数 ll lcm(ll a, ll b) { return (a / gcd(a, b))*b; } //最小公倍数 ll MAX(ll a, ll b) { if (a > b)return a; else return b; } //MAX ll MIN(ll a, ll b) { if (a < b)return a; else return b; } //MIN bool p_judge(ll p) { if (p == 1)return false; else if (p == 2)return true; else { bool flag = true; for (int i = 2; i <= sqrt(p); i++) { if (p%i == 0) { flag = false; break; } } return flag; } } //素数判定,素数=true,合成数=false int main() { int N; pair<int, int> P[30005]; cin >> N; for (int i = 0; i < N; i++) { string str; cin >> str; int m = stoi(str.substr(0, 2)); P[i] = make_pair(stoi(str.substr(0, 2)) * 60 + stoi(str.substr(2, 2)), stoi(str.substr(5, 2)) * 60 + stoi(str.substr(7, 2))); P[i].first = P[i].first - P[i].first % 5; if (P[i].second % 5 != 0)P[i].second = P[i].second - P[i].second % 5 + 5; } int line[1500]; for (int i = 0; i < 1500; i++)line[i] = 0; for (int i = 0; i < N; i++) { line[P[i].first]++; line[P[i].second]--; } for (int i = 1; i < 1500; i++) { line[i] += line[i - 1]; } bool flag = false; int tmp; for (int i = 0; i < 1500; i++) { if (line[i] > 0 && !flag) { flag = true; tmp = i; } else if (line[i] == 0 && flag) { flag = false; printf("%02d%02d-%02d%02d\n", (tmp - tmp % 60) / 60, tmp % 60, (i - i % 60) / 60, i % 60); } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | pelno |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 2708 Byte |
Status | AC |
Exec Time | 32 ms |
Memory | 640 KB |
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
all | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, cho_cho_chokudai.txt, chokudai_ga_cho.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 1 ms | 512 KB |
00_sample_02.txt | AC | 1 ms | 512 KB |
00_sample_03.txt | AC | 1 ms | 512 KB |
cho_cho_chokudai.txt | AC | 31 ms | 512 KB |
chokudai_ga_cho.txt | AC | 31 ms | 512 KB |
test_01.txt | AC | 1 ms | 512 KB |
test_02.txt | AC | 1 ms | 512 KB |
test_03.txt | AC | 2 ms | 512 KB |
test_04.txt | AC | 1 ms | 512 KB |
test_05.txt | AC | 1 ms | 512 KB |
test_06.txt | AC | 2 ms | 512 KB |
test_07.txt | AC | 1 ms | 512 KB |
test_08.txt | AC | 1 ms | 512 KB |
test_09.txt | AC | 2 ms | 512 KB |
test_10.txt | AC | 2 ms | 512 KB |
test_11.txt | AC | 2 ms | 512 KB |
test_12.txt | AC | 2 ms | 512 KB |
test_13.txt | AC | 2 ms | 512 KB |
test_14.txt | AC | 2 ms | 512 KB |
test_15.txt | AC | 2 ms | 512 KB |
test_16.txt | AC | 2 ms | 512 KB |
test_17.txt | AC | 2 ms | 512 KB |
test_18.txt | AC | 2 ms | 512 KB |
test_19.txt | AC | 2 ms | 512 KB |
test_20.txt | AC | 2 ms | 512 KB |
test_21.txt | AC | 32 ms | 512 KB |
test_22.txt | AC | 31 ms | 512 KB |
test_23.txt | AC | 32 ms | 512 KB |
test_24.txt | AC | 31 ms | 512 KB |
test_25.txt | AC | 32 ms | 512 KB |
test_26.txt | AC | 31 ms | 512 KB |
test_27.txt | AC | 31 ms | 512 KB |
test_28.txt | AC | 32 ms | 512 KB |
test_29.txt | AC | 1 ms | 512 KB |
test_30.txt | AC | 1 ms | 512 KB |
test_31.txt | AC | 6 ms | 512 KB |
test_32.txt | AC | 1 ms | 512 KB |
test_33.txt | AC | 21 ms | 512 KB |
test_34.txt | AC | 1 ms | 512 KB |
test_35.txt | AC | 2 ms | 512 KB |
test_36.txt | AC | 31 ms | 512 KB |
test_37.txt | AC | 32 ms | 512 KB |
test_38.txt | AC | 31 ms | 640 KB |
test_39.txt | AC | 32 ms | 512 KB |
test_40.txt | AC | 32 ms | 512 KB |
test_41.txt | AC | 31 ms | 512 KB |
test_42.txt | AC | 32 ms | 512 KB |
test_43.txt | AC | 31 ms | 512 KB |