ENG  RUS Timus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

## Обсуждение задачи 1280. Topological Sorting

WA#33
Послано Anton [SUrSU#6] 25 июн 2006 01:42
Who can give me some tricky tests for this problem, please!
Re: WA#33
Послано PSV 3 ноя 2006 04:55
May be you need a more tricky algo? It's unable to have WA with this problem (quite simple algo)
Re: WA#33
Послано Jabarov_Roman 10 ноя 2006 02:04
Please help, i have the same problem but i don't know where is my error here is code
#include <iostream>
using namespace std;
int power[1005];
int deg[1005];
int mas[1005][1005];
int n,m;
void input()
{
cin>>n>>m;
int a,b;
for(int i=0;i<m;i++)
{
cin>>a>>b;
mas[a][power[a]++] = b;
deg[b]++;
}
for(int i=0;i<n;i++)
}
void solve()
{
for(int i=0;i<n;i++)
{
{
cout<<"NO";
return;
}
}
cout<<"YES";
}
int main()
{
input();
solve();
return 0;
}
Re: WA#33
Послано Nechaev Ilya (Rybinsk SAAT) 10 ноя 2006 04:00
I don't know what are you doing, but you need just check M conditions for given sequence. I don't know what can be wrong.

Edited by author 10.11.2006 04:29
Re: WA#33
Послано Nechaev Ilya (Rybinsk SAAT) 10 ноя 2006 04:20
Haha. I just changed
int mas[1005][1005];
to
int mas[1005][10005];
and get AC.
I think that each limitation can occur in the input more than once i.e. some limitations can be equal    :-p

Advice: this solution use too much memory. Really you need less than 1 Mb.

Edited by author 10.11.2006 14:02
Re: WA#33
Послано WhiteRabbit 10 ноя 2006 18:42
Thank you for advise. Now i just changed adjanced list stored in array to vector<vector<int> > . And my programm used only 860 Kb.
Re: WA#33
Послано Jabarov_Roman 10 ноя 2006 23:42
Nechaev Ilya (Rybinsk SAAT) писал(a) 10 ноября 2006 04:20
Haha. I just changed
int mas[1005][1005];
to
int mas[1005][10005];
and get AC.
I think that each limitation can occur in the input more than once i.e. some limitations can be equal    :-p

Advice: this solution use too much memory. Really you need less than 1 Mb.

Edited by author 10.11.2006 14:02

I'm very appreciate you. I used vector<vector<int> > and eventually got AC:-)
Re: WA#33
Послано MAK 12 окт 2009 03:42