Submission #62796

# Submission time Handle Problem Language Result Execution time Memory
62796 2018-07-30T05:32:25 Z BBang3 None (KOI18_matrix) C++14
14 / 100
4000 ms 4108 KB
#include <cstdio>
#include <algorithm>
using namespace std;

struct H
{
	int a;
	int b;

	H() {}
	H(int a, int b) : a(a), b(b) {}

	bool operator < (const H &t)
	{
		return a < t.a;
	}
};

int N, M;
int arr[3][200000 + 5];
H matrix[200000 + 5];
int D[200000 + 5];

int main()
{
	scanf("%d %d", &M, &N);

	for (int i = 0; i < M; i++)
	{
		for (int j = 1; j <= N; j++)
		{
			scanf("%d", &arr[i][j]);
		}
	}
	int ans = 1;
	if (M == 2)
	{
		for (int i = 1; i <= N; i++)
		{
			matrix[i] = H(arr[0][i], arr[1][i]);
		}
		sort(matrix + 1, matrix + 1 + N);

		for (int i = 1; i <= N; i++)
		{
			D[i] = 1;
			for (int j = 1; j < i; j++)
			{
				if (matrix[j].b < matrix[i].b)
				{
					D[i] = max(D[i], D[j] + 1);
					ans = max(ans, D[i]);
				}
			}
		}
	}
	printf("%d", ans);
	return 0;
}

Compilation message

matrix.cpp: In function 'int main()':
matrix.cpp:26:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &M, &N);
  ~~~~~^~~~~~~~~~~~~~~~~
matrix.cpp:32:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &arr[i][j]);
    ~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 234 ms 504 KB Output is correct
2 Correct 171 ms 744 KB Output is correct
3 Correct 186 ms 800 KB Output is correct
4 Correct 175 ms 800 KB Output is correct
5 Correct 210 ms 800 KB Output is correct
6 Correct 172 ms 800 KB Output is correct
7 Correct 169 ms 800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 800 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 234 ms 504 KB Output is correct
2 Correct 171 ms 744 KB Output is correct
3 Correct 186 ms 800 KB Output is correct
4 Correct 175 ms 800 KB Output is correct
5 Correct 210 ms 800 KB Output is correct
6 Correct 172 ms 800 KB Output is correct
7 Correct 169 ms 800 KB Output is correct
8 Execution timed out 4017 ms 4108 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 800 KB Output isn't correct
2 Halted 0 ms 0 KB -