# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
51771 | model_code | Telegraph (JOI16_telegraph) | C++17 | 51 ms | 58160 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN=100000;
int main()
{
int n;
scanf("%d",&n);
static int A[MAXN];
static long long C[MAXN];
for(int i=0;i<n;i++){
scanf("%d%lld",A+i,C+i);
A[i]--;
}
static int b[MAXN];
for(int i=0;i<n;i++){
b[i]=-1;
}
bool F=0;
for(int i=0;i<n;i++){
if(b[i]!=-1){
continue;
}
int j=i;
while(b[j]==-1){
b[j]=i;
j=A[j];
}
Compilation message (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... |