Hi everybody,
I just was wondering, what editor you are using during the contest (C++). I have been using kate for quite a while, but I am not really comfortible with it, the only need feature is, that I have my console down there. :)
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
4 | atcoder_official | 161 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Hi everybody,
I just was wondering, what editor you are using during the contest (C++). I have been using kate for quite a while, but I am not really comfortible with it, the only need feature is, that I have my console down there. :)
Hi,
I just tried to solve some problem and the compiler of codeforces gave a different result.
UPD: I minimized the code a little bit.
Here is one Code
#include <iostream>
#include <stdio.h>
#include <memory.h>
#include <vector>
#include <set>
#include <math.h>
#include <algorithm>
#include <cstring>
using namespace std;
#define REP(a,b) for(int (a)=0;a<(int)b;a++)
#define PB push_back
#define s(a) scanf("%d",&a);
#define foreach(a,b) for(__typeof(b).begin() a = b.begin(); a != b.end();a++)
vector<int> next[50];
bool visited[50];
int counter=0;
void DFS(int pos)
{
if(!visited[pos])
{
visited[pos]=true;
foreach(it,next[pos])
{
if(!visited[*it])
{
DFS(*it);
}
}
}
}
int main()
{
int N;int M;
s(N);s(M);
REP(n,M)
{
int a;
int b;
s(a);s(b);
a--;
b--;
next[a].PB(b);
next[b].PB(a);
}
if(N==M)
{
memset(visited,0,sizeof(visited));
REP(n,N)
{
if(!visited[n])
{
counter++;
DFS(n);
}
}
cout<<"Counter "<<counter<<endl;
}
else
{
REP(n,N)
{
DFS(n);
}
}
}
The input is
2 2
1 2
2 1
On my local machine it prints out 1, while on codeforces it prints out 2, which should be wrong.
Название |
---|