# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1078961 | Hanksburger | 9월 (APIO24_september) | C++17 | 134 ms | 10448 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "september.h"
#include <bits/stdc++.h>
using namespace std;
set<int> buff[5], s;
vector<int> p, tmp;
int deg[100005];
void process(int u)
{
if (deg[u])
s.insert(u);
else
{
deg[p[u]]--;
while (!deg[p[u]] && s.find(p[u])!=s.end())
{
u=p[u];
s.erase(u);
deg[p[u]]--;
}
}
}
int solve(int n, int m, vector<int> P, vector<vector<int> > a)
{
p=P;
for (int i=1; i<n; i++)
deg[p[i]]++;
int cnt=0;
for (int i=0; i<=n-2; i++)
{
for (int j=0; j<m; j++)
buff[j].insert(a[j][i]);
int u=*buff[0].begin(), ok=1;
while (1)
{
for (int j=1; j<m; j++)
{
if (buff[j].find(u)==buff[j].end())
{
ok=0;
break;
}
}
if (!ok)
break;
tmp.push_back(u);
for (int j=0; j<m; j++)
buff[j].erase(u);
if (buff[0].empty())
break;
u=*buff[0].begin();
}
if (buff[0].empty())
{
for (int j=0; j<tmp.size(); j++)
process(tmp[j]);
tmp.clear();
if (s.empty())
cnt++;
}
}
return cnt;
}
컴파일 시 표준 에러 (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... |
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |