Submission #1655499


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1e9+100;
const ll MOD = 1e9;
const double EPS = 1e-10;
const bool debug = 1;
//------------------------------//

int N;
int a[112345], b[112345];
int cnt[86400];

int main() {
	cin >> N;
	REP(i, N) scanf("%d %d", a + i, b + i);
	
	int day = 86400, ear = 10800;
	
	int t = 0;
	REP(i, N) {
		t = (t + a[i]) % day;
		cnt[t]++;
		t = (t + b[i]) % day;
	}
	
	int r = 0, now = 0;
	int ans = 0;
	
	REP(l, day) {
		while ((r - l + day) % day <= ear) {
			now += cnt[r];
			r = (r + 1) % day;
		}
		
		chmax(ans, now);
		now -= cnt[l];
	}
	chmax(ans, now);
	
	cout << ans << endl;
	
	return 0;
}

Submission Info

Submission Time
Task H - Early Bird
User tkmst201
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1156 Byte
Status AC
Exec Time 20 ms
Memory 1408 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:26:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  REP(i, N) scanf("%d %d", a + i, b + i);
                                        ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 23
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All sample_01.txt, sample_02.txt, sample_01.txt, sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt
Case Name Status Exec Time Memory
sample_01.txt AC 2 ms 256 KB
sample_02.txt AC 2 ms 256 KB
subtask1_01.txt AC 19 ms 1408 KB
subtask1_02.txt AC 19 ms 1408 KB
subtask1_03.txt AC 19 ms 1408 KB
subtask1_04.txt AC 19 ms 1408 KB
subtask1_05.txt AC 19 ms 1408 KB
subtask1_06.txt AC 20 ms 1408 KB
subtask1_07.txt AC 19 ms 1408 KB
subtask1_08.txt AC 19 ms 1408 KB
subtask1_09.txt AC 19 ms 1408 KB
subtask1_10.txt AC 19 ms 1408 KB
subtask1_11.txt AC 19 ms 1408 KB
subtask1_12.txt AC 20 ms 1408 KB
subtask1_13.txt AC 19 ms 1408 KB
subtask1_14.txt AC 19 ms 1408 KB
subtask1_15.txt AC 20 ms 1408 KB
subtask1_16.txt AC 19 ms 1408 KB
subtask1_17.txt AC 20 ms 1408 KB
subtask1_18.txt AC 20 ms 1408 KB
subtask1_19.txt AC 19 ms 1408 KB