Submission #12106285


Source Code Expand

Copy
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  
    cout.tie(0);   
#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif

// -------------------------------------Code starts here---------------------------------------------------------------------     

  int n;
  cin>>n;
  int degree[n+1]={0};
  int x,y;
  for(int i=0;i<n-1;i++)
  {
    cin>>x;
    degree[x]++;
  }

  for(int i=1;i<=n;i++)
    cout<<degree[i]<<'\n';

 
// -------------------------------------Code ends here------------------------------------------------------------------
    clock_t clk;
  clk = clock();

    clk = clock() - clk;
  cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
  return 0;
}

Submission Info

Submission Time
Task C - management
User babayaga
Language C++ (GCC 9.2.1)
Score 300
Code Size 1208 Byte
Status AC
Exec Time 34 ms
Memory 5372 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:30:9: warning: unused variable ‘y’ [-Wunused-variable]
   30 |   int x,y;
      |         ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
Set Name Test Cases
Sample sample_01, sample_02, sample_03
All binary_01, binary_02, line_01, line_02, random_01, random_02, random_03, random_04, sample_01, sample_02, sample_03, small_01, star_01, star_02, star_03
Case Name Status Exec Time Memory
binary_01 AC 31 ms 5308 KB
binary_02 AC 29 ms 5372 KB
line_01 AC 30 ms 5284 KB
line_02 AC 32 ms 5340 KB
random_01 AC 34 ms 5320 KB
random_02 AC 30 ms 5004 KB
random_03 AC 29 ms 5136 KB
random_04 AC 18 ms 4280 KB
sample_01 AC 6 ms 3820 KB
sample_02 AC 2 ms 3768 KB
sample_03 AC 2 ms 3712 KB
small_01 AC 2 ms 3712 KB
star_01 AC 28 ms 5240 KB
star_02 AC 29 ms 5328 KB
star_03 AC 28 ms 5276 KB