# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
85376 | tjdgus4384 | 조화행렬 (KOI18_matrix) | C++14 | 9 ms | 1148 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
vector<pair<int, pair<int, int> > > v;
vector<int> vf;
vector<int> vs;
int main()
{
int m, n, x;
scanf("%d %d",&m, &n);
v.resize(n);
for(int i = 0;i < m;i++)
{
for(int j = 0;j < n;j++)
{
scanf("%d", &x);
if(i == 0) v[j].first = x;
if(i == 1) v[j].second.first = x;
if(i == 2) v[j].second.second = x;
if(i == 0 && m == 2) v[j].second.second = v[j].first;
}
}
sort(v.begin(), v.end());
vf.push_back({-1000000000});
vs.push_back({-1000000000});
for(int i = 0;i < n;i++)
{
int f = v[i].second.first;
int s = v[i].second.second;
if(f > vf.back() && s > vs.back())
{
vf.push_back(f);
vs.push_back(s);
}
else if(f < vf.back() && s < vs.back())
{
int fx = lower_bound(vf.begin(), vf.end(), f) - vf.begin();
int sx = lower_bound(vs.begin(), vs.end(), s) - vs.begin();
fx = max(fx, sx);
sx = fx;
vf[fx] = f;
vs[sx] = s;
}
}
printf("%d", vf.size() - 1);
}
컴파일 시 표준 에러 (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... |