# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
62796 | BBang3 | 조화행렬 (KOI18_matrix) | C++14 | 4017 ms | 4108 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |