Submission #2049702


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int h, m, s;
	int c1, c2;
	cin >> h >> m >> s >> c1 >> c2;
	int tmp = 0;
	int ans1 = -1, ans2 = -1;
	while (++tmp)
	{
		
		int sec = h % 12 * 3600 + m * 60 + s;
		ld ah = sec / 43200.0;
		ld am = sec % 3600 / 3600.0;
		ld as = sec % 60 / 60.0;
		sec++;
		ld bh = sec / 43200.0;
		ld bm = sec % 3600 / 3600.0;
		ld bs = sec % 60 / 60.0;
		if (ah > am && bh < bm)
		{
			//cout << h << " " << m << " " << s << endl;
			c2--;
		}
		if (am > as && bm < bs)
		{
			//cout << h << " " << m << " " << s << endl;
			c1--;
		}

		if (c1 == 0 && c2 == 0)
		{
			if (ans1 == -1) ans1 = tmp;
			chmax(ans2, tmp);
		}

		if (h == 11 && m == 59 && s == 59)
		{
			//cout << h << " " << m << " " << s << endl;
			c2--;
		}
		if (ah > am && bh == bm)
		{
			//cout << h << " " << m << " " << s << endl;
			c2--;
		}
		if (am > as && bm == bs)
		{
			//cout << h << " " << m << " " << s << endl;
			c1--;
		}
		
		if (c1 < 0 || c2 < 0)
		{
			break;
		}
		s++;
		if (s == 60)
		{
			s = 0;
			m++;
		}
		if (m == 60)
		{
			m = 0;
			h++;
		}
		if (h == 13)
		{
			h = 1;
		}
	}
	if (ans1 == -1) cout << -1 << endl;
	else cout << ans1 << " " << ans2 << endl;
	return 0;
}

Submission Info

Submission Time
Task A - アナログ時計
User amano
Language C++14 (GCC 5.4.1)
Score 0
Code Size 2196 Byte
Status WA
Exec Time 19 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 0 / 400
Status
AC × 35
WA × 1
Set Name Test Cases
All _sample_01, _sample_02, _sample_03, _sample_04, corner_01, corner_02, fixed-random-01, fixed-random-02, fixed-random-03, fixed-random-04, fixed-random-05, fixed-random-06, fixed-random-07, fixed-random-08, fixed-random-09, fixed-random-10, large-01, large-02, large-03, large-04, large-05, large-06, large-07, large-08, large-09, large-10, random-01, random-02, random-03, random-04, random-05, random-06, random-07, random-08, random-09, random-10
Case Name Status Exec Time Memory
_sample_01 AC 1 ms 256 KB
_sample_02 AC 1 ms 256 KB
_sample_03 AC 1 ms 256 KB
_sample_04 AC 19 ms 256 KB
corner_01 WA 19 ms 256 KB
corner_02 AC 1 ms 256 KB
fixed-random-01 AC 17 ms 256 KB
fixed-random-02 AC 2 ms 256 KB
fixed-random-03 AC 13 ms 256 KB
fixed-random-04 AC 4 ms 256 KB
fixed-random-05 AC 18 ms 256 KB
fixed-random-06 AC 18 ms 256 KB
fixed-random-07 AC 13 ms 256 KB
fixed-random-08 AC 17 ms 256 KB
fixed-random-09 AC 16 ms 256 KB
fixed-random-10 AC 15 ms 256 KB
large-01 AC 18 ms 256 KB
large-02 AC 19 ms 256 KB
large-03 AC 18 ms 256 KB
large-04 AC 18 ms 256 KB
large-05 AC 19 ms 256 KB
large-06 AC 18 ms 256 KB
large-07 AC 18 ms 256 KB
large-08 AC 18 ms 256 KB
large-09 AC 19 ms 256 KB
large-10 AC 19 ms 256 KB
random-01 AC 9 ms 256 KB
random-02 AC 10 ms 256 KB
random-03 AC 3 ms 256 KB
random-04 AC 16 ms 256 KB
random-05 AC 17 ms 256 KB
random-06 AC 6 ms 256 KB
random-07 AC 16 ms 256 KB
random-08 AC 1 ms 256 KB
random-09 AC 5 ms 256 KB
random-10 AC 4 ms 256 KB