Submission #66959657


Source Code Expand

#include <bits/stdc++.h>
#define fs first
#define se second
using namespace std;
#define For(s,e) \
  for(int i=s;i<=e;++i)
#define ForR(s,e) \ 
  for(int i=s;i>=e;--i)
#define FOR(n) \
  for(int i=0;i<n;++i)
#define FORR(n) \ 
  for(int i=n-1;i>=0;--i)
#define IN(a,n) \
  FOR(n){\
    cin>>a[i];\
  }

struct node{
  string s = "";
  node*p = NULL;
};
int main(int /* argc */, char** /* argv */) {
  int n,m;
  cin>>n>>m;
  node* a[n+1];
  memset(a,0,sizeof(a));
  for(int i=0;i<m;++i){
    int q,p;
    cin>>q>>p;
    --p;
    if(q==1){
      a[p]=a[n];
    }else if(q==2){
      string ss;
      node*pointer=new node();
      cin>>pointer->s;
      pointer->p=a[p];
      a[p]=pointer;
    } else{
      a[n]=a[p];
    }
  }
  node*p=a[n];
  stack<node*>ps;
  while(p!=NULL){
    ps.emplace(p);
    p=p->p;
  }
  while(ps.size()){
    p=ps.top();
    ps.pop();
    cout<<p->s;
  }
  
  cout<<endl;
  
  return 0;
}

Submission Info

Submission Time
Task D - Conflict 2
User zz050201010
Language C++ 23 (Clang 16.0.6)
Score 425
Code Size 976 Byte
Status AC
Exec Time 95 ms
Memory 16768 KiB

Compile Error

./Main.cpp:7:20: warning: backslash and newline separated by space [-Wbackslash-newline-escape]
#define ForR(s,e) \ 
                   ^
./Main.cpp:11:18: warning: backslash and newline separated by space [-Wbackslash-newline-escape]
#define FORR(n) \ 
                 ^
2 warnings generated.

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 425 / 425
Status
AC × 3
AC × 49
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 02_random2_10.txt, 02_random2_11.txt, 02_random2_12.txt, 02_random2_13.txt, 02_random2_14.txt, 02_random2_15.txt, 03_random3_00.txt, 03_random3_01.txt, 03_random3_02.txt, 03_random3_03.txt, 04_random4_00.txt, 04_random4_01.txt, 05_random5_00.txt, 05_random5_01.txt, 06_handmade_00.txt, 06_handmade_01.txt, 06_handmade_02.txt, 06_handmade_03.txt, 06_handmade_04.txt, 06_handmade_05.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3440 KiB
00_sample_01.txt AC 2 ms 4168 KiB
00_sample_02.txt AC 1 ms 3396 KiB
01_random_00.txt AC 10 ms 5768 KiB
01_random_01.txt AC 56 ms 6804 KiB
01_random_02.txt AC 59 ms 6380 KiB
01_random_03.txt AC 7 ms 5308 KiB
01_random_04.txt AC 57 ms 8168 KiB
01_random_05.txt AC 14 ms 4708 KiB
01_random_06.txt AC 15 ms 5524 KiB
01_random_07.txt AC 14 ms 4816 KiB
01_random_08.txt AC 48 ms 6284 KiB
01_random_09.txt AC 52 ms 6648 KiB
01_random_10.txt AC 48 ms 6544 KiB
01_random_11.txt AC 16 ms 4264 KiB
01_random_12.txt AC 44 ms 7320 KiB
01_random_13.txt AC 42 ms 6520 KiB
01_random_14.txt AC 50 ms 6124 KiB
01_random_15.txt AC 37 ms 5588 KiB
02_random2_00.txt AC 78 ms 9612 KiB
02_random2_01.txt AC 81 ms 9716 KiB
02_random2_02.txt AC 77 ms 9756 KiB
02_random2_03.txt AC 80 ms 9676 KiB
02_random2_04.txt AC 93 ms 11892 KiB
02_random2_05.txt AC 91 ms 11036 KiB
02_random2_06.txt AC 87 ms 10020 KiB
02_random2_07.txt AC 69 ms 7636 KiB
02_random2_08.txt AC 95 ms 13312 KiB
02_random2_09.txt AC 90 ms 10988 KiB
02_random2_10.txt AC 87 ms 9660 KiB
02_random2_11.txt AC 65 ms 6452 KiB
02_random2_12.txt AC 95 ms 15968 KiB
02_random2_13.txt AC 85 ms 10668 KiB
02_random2_14.txt AC 81 ms 9240 KiB
02_random2_15.txt AC 59 ms 4944 KiB
03_random3_00.txt AC 80 ms 9456 KiB
03_random3_01.txt AC 81 ms 9476 KiB
03_random3_02.txt AC 82 ms 9448 KiB
03_random3_03.txt AC 58 ms 7912 KiB
04_random4_00.txt AC 80 ms 9456 KiB
04_random4_01.txt AC 80 ms 9540 KiB
05_random5_00.txt AC 92 ms 16768 KiB
05_random5_01.txt AC 93 ms 16708 KiB
06_handmade_00.txt AC 1 ms 3444 KiB
06_handmade_01.txt AC 14 ms 5188 KiB
06_handmade_02.txt AC 62 ms 5000 KiB
06_handmade_03.txt AC 92 ms 14432 KiB
06_handmade_04.txt AC 62 ms 5004 KiB
06_handmade_05.txt AC 62 ms 10544 KiB