Submission #594175

# Submission time Handle Problem Language Result Execution time Memory
594175 2022-07-12T07:39:18 Z Zanite Collecting Stamps 3 (JOI20_ho_t3) C++17
0 / 100
1 ms 212 KB
// I am now here, but I have yet to prove that I am worthy of my place here.

#include <bits/stdc++.h>
using namespace std;

using ll	= long long;
using pll	= pair<ll, ll>;

#define fi	first
#define se	second

const int maxN	= 201;

const ll INF	= 1e18;

ll N, L;
ll T[maxN], CW[maxN], CCW[maxN];
ll dp[maxN][maxN];

int main() {
	scanf("%lld %lld", &N, &L);
	for (ll i = 1; i <= N; i++) {scanf("%lld", &CW[i]); CCW[i] = L - CW[i];}
	for (ll i = 1; i <= N; i++) {scanf("%lld", &T[i]);}

	//for (ll i = 1; i <= N; i++) {
	//	cout << CW[i] << ' ' << CCW[i] << '\n';
	//}

	ll ans = 0;

	// clockwise
	for (ll en = 1; en <= N; en++) {
		ll cur = 0;
		for (ll i = 1; i <= en; i++) {
			if (CW[i] <= T[i]) cur++;
		}
		ll d = 2*CW[en];
		for (ll i = N; i > en; i--) {
			if (d+CCW[i] <= T[i]) cur++;
		}
		ans = max(ans, cur);
	}

	// counterclockwise
	for (ll en = 1; en <= N; en++) {
		ll cur = 0;
		for (ll i = N; i >= en; i--) {
			if (CCW[i] <= T[i]) cur++;
		}
		ll d = 2*CCW[en];
		for (ll i = 1; i < en; i++) {
			if (d+CW[i] <= T[i]) cur++;
		}
		ans = max(ans, cur);
	}

	printf("%lld\n", ans);
}

Compilation message

ho_t3.cpp: In function 'int main()':
ho_t3.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |  scanf("%lld %lld", &N, &L);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~
ho_t3.cpp:22:36: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |  for (ll i = 1; i <= N; i++) {scanf("%lld", &CW[i]); CCW[i] = L - CW[i];}
      |                               ~~~~~^~~~~~~~~~~~~~~~
ho_t3.cpp:23:36: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |  for (ll i = 1; i <= N; i++) {scanf("%lld", &T[i]);}
      |                               ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -