| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 363231 | Tenis0206 | Shell (info1cup18_shell) | C++11 | 592 ms | 81512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int Mod = 1e9+7;
int n,m,p,spc[1000005];
long long lvl[1000005],cnt[1000005];
bool sel[1000005];
vector<int> G[1000005],IN[1000005],d;
void dfs(int x)
{
sel[x]=true;
for(auto it : G[x])
{
if(!sel[it])
{
dfs(it);
}
}
d.push_back(x);
}
void topsort()
{
dfs(1);
reverse(d.begin(),d.end());
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n>>m>>p;
for(int i=1;i<=p;i++)
{
int x;
cin>>x;
spc[x]=i;
}
for(int i=1;i<=m;i++)
{
int x,y;
cin>>x>>y;
G[x].push_back(y);
IN[y].push_back(x);
}
topsort();
memset(sel,false,sizeof(sel));
cnt[1]=1;
for(auto nod : d)
{
sel[nod]=true;
int tofind = 0;
if(spc[nod])
{
lvl[nod]=spc[nod];
}
for(auto it : IN[nod])
{
if(!spc[nod] && lvl[it]>lvl[nod])
{
lvl[nod]=lvl[it];
cnt[nod]=0;
}
if(!spc[nod] && lvl[it]==lvl[nod])
{
cnt[nod]+=cnt[it];
cnt[nod]%=Mod;
}
if(spc[nod] && lvl[it]==lvl[nod]-1)
{
cnt[nod]+=cnt[it];
cnt[nod]%=Mod;
}
}
}
if(lvl[n]==p)
{
cout<<cnt[n]%Mod<<'\n';
return 0;
}
cout<<0<<'\n';
return 0;
}컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
