답안 #731831

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
731831 2023-04-28T04:45:04 Z maeola 걷기 (NOI12_walking) C++17
25 / 25
2 ms 316 KB
// trans rights
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int L, N;
int U[505];

int main(int argc, const char *argv[])
{
	scanf(" %d %d", &L, &N);
	vector<pair<int, int>> ac;
	for (int i = 0; i < N; i++)
	{
		int t, v;
		scanf(" %d %d", &t, &v);
		ac.push_back({t, v});
	}
	sort(ac.begin(), ac.end());
	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		int g = 0;
		for (int j = 0; j < i; j++)
		{
			if (L * ac[i].second +
				ac[j].first * ac[i].second * ac[j].second >
			    L * ac[j].second +
				ac[i].first * ac[i].second * ac[j].second)
			{
				g = max(g, U[j]);
			}
		}
		U[i] = g + 1;
		ans = max(ans, U[i]);
	}
	printf("%d", ans);
	return 0;
}

Compilation message

walking.cpp: In function 'int main(int, const char**)':
walking.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf(" %d %d", &L, &N);
      |  ~~~~~^~~~~~~~~~~~~~~~~~
walking.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   scanf(" %d %d", &t, &v);
      |   ~~~~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 244 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 316 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 212 KB Output is correct