Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 2000001
//????????????£????????????
struct Node{
  int key;
  struct Node *next,*prev;
};
 
struct Node *nil;
 
struct Node* listSearch(int key){
  struct Node *cur=nil->next;
  while(cur!=nil&&cur->key!=key){
    cur=cur->next;
  }
  return cur;
}
 
void init(){
  nil=(struct Node *)malloc(sizeof(struct Node));
  nil->next=nil;
  nil->prev=nil;
}
 
void output(){
  struct Node *cur=nil->next;
  int i=0;
  while(1){
    if(cur==nil) break;
    if(i++>0) printf(" ");
    printf("%d",cur->key);
    cur=cur->next;
    }
  printf("\n");
}
 
void delNode(struct Node *t){
  if(t==nil) return;
  t->prev->next=t->next;
  t->next->prev=t->prev;
  free(t);
}
 
void delF(){
  delNode(nil->next);
}
 
void delL(){
  delNode(nil->prev);
}
 
void delKey(int key){
  delNode(listSearch(key));
}
 
void insert(int key){
  struct Node *a=(struct Node *)malloc(sizeof(struct Node));
  a->key=key;
  a->next=nil->next;
  nil->next->prev=a;
  nil->next=a;
  a->prev=nil;
}
 
int main(){
  int n,key,i,j,npoi=0,ndel=0,size=0;
  char c[12];
 
  scanf("%d",&n);
 
  init();
  for(i=0;i<n;i++){
    scanf("%s %d",c,&key);
 
    if(c[0]=='i'){
      insert(key);
      npoi++;
      size++;
    }
    else if(c[0]=='d'){
if(strlen(c)>6){
      if(c[6]=='F') delF();
      else if(c[6]=='L') delL();
    } else {
        delKey(key);
        ndel++;
      }
        size--;
      }
    }
    output();
  return 0;
}
Compile Error Logs:
You are not authorized to see the message.

Status
Judge: 10/10 	C 	CPU: 00.33 sec 	Memory: 31788 KB 	Length: 1477 B 	2017-07-23 10:54 	2017-07-23 10:54
Results for testcases
Case # 	Verdict 	CPU Time 	Memory 	In 	Out 	Case Name
Case #1: 	: Accepted 	00.00 sec 	600 KB 	88 B 	2 B 	01.in
Case #2: 	: Accepted 	00.00 sec 	600 KB 	203 B 	10 B 	02.in
Case #3: 	: Accepted 	00.00 sec 	600 KB 	375 B 	10 B 	03.in
Case #4: 	: Accepted 	00.00 sec 	600 KB 	105 B 	23 B 	04.in
Case #5: 	: Accepted 	00.00 sec 	600 KB 	643 B 	58 B 	05.in
Case #6: 	: Accepted 	00.00 sec 	596 KB 	52 B 	2 B 	06.in
Case #7: 	: Accepted 	00.00 sec 	596 KB 	1058 B 	110 B 	07.in
Case #8: 	: Accepted 	00.00 sec 	600 KB 	1031 B 	116 B 	08.in
Case #9: 	: Accepted 	00.33 sec 	600 KB 	22392494 B 	5 B 	09.in
Case #10: 	: Accepted 	00.32 sec 	31788 KB 	25527813 B 	1288799 B 	10.in
< prev | 	1 	/ 	10 	| next > 	  		 : Accepted        00.00 sec        600 KB
 
Judge Input #1 ( in1.txt | 88 B) 		Judge Output #1 ( out1.txt | 2 B)

9
insert 5
insert 2
insert 3
insert 1
delete 3
insert 6
delete 5
deleteFirst
deleteLast

		

1

Comments
 
 Under Construction.
 
Categories
 
 
Free Tags
 
 

Compiler output:
main.c:96:1: error: unknown type name 'Compile'
   96 | Compile Error Logs:
      | ^~~~~~~
main.c:96:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Logs'
   96 | Compile Error Logs:
      |               ^~~~
main.c:102:6: error: stray '#' in program
  102 | Case #  Verdict         CPU Time        Memory  In      Out     Case Name
      |      ^
main.c:103:6: error: stray '#' in program
  103 | Case #1:        : Accepted      00.00 sec       600 KB  88 B    2 B     01.in
      |      ^
main.c:103:73: error: invalid suffix "in" on floating constant
  103 | Case #1:        : Accepted      00.00 sec       600 KB  88 B    2 B     01.in
      |                                                                         ^~~~~
main.c:104:6: error: stray '#' in program
  104 | Case #2:        : Accepted      00.00 sec       600 KB  203 B   10 B    02.in
      |      ^
main.c:104:73: error: invalid suffix "in" on floating constant
  104 | Case #2:        : Accepted      00.00 sec       600 KB  203 B   10 B    02.in
      |                                                                         ^~~~~
main.c:105:6: error: stray '#' in program
  105 | Case #3:        : Accepted      00.00 sec       600 KB  375 B   10 B    03.in
      |      ^
main.c:105:73: error: invalid suffix "in" on floating constant
  105 | Case #3:        : Accepted      00.00 sec       600 KB  375 B   10 B    03.in
      |                                                                         ^~~~~
main.c:106:6: error: stray '#' in program
  106 | Case #4:        : Accepted      00.00 sec       600 KB  105 B   23 B    04.in
      |      ^
main.c:106:73: error: invalid suffix "in" on floating constant
  106 | Case #4:        : Accepted      00.00 sec       600 KB  105 B   23 B    04.in
      |                                                                         ^~~~~
main.c:107:6: error: stray '#' in program
  107 | Case #5:        : Accepted      00.00 sec       600 KB  643 B   58 B    05.in
      |      ^
main.c:107:73: error: invalid suffix "in" on floating constant
  107 | Case #5:        : Accepted      00.00 sec       600 KB  643 B   58 B    05.in
      |                                                                         ^~~~~
main.c:108:6: error: stray '#' in program
  108 | Case #6:        : Accepted      00.00 sec       596 KB  52 B    2 B     06.in
      |      ^
main.c:108:73: error: invalid suffix "in" on floating constant
  108 | Case #6:        : Accepted      00.00 sec       596 KB  52 B    2 B     06.in
      |                                                                         ^~~~~
main.c:109:6: error: stray '#' in program
  109 | Case #7:        : Accepted      00.00 sec       596 KB  1058 B  110 B   07.in
      |      ^
main.c:109:73: error: invalid suffix "in" on floating constant
  109 | Case #7:        : Accepted      00.00 sec       596 KB  1058 B  110 B   07.in
      |                                                                         ^~~~~
main.c:110:6: error: stray '#' in program
  110 | Case #8:        : Accepted      00.00 sec       600 KB  1031 B  116 B   08.in
      |      ^
main.c:110:73: error: invalid suffix "in" on floating constant
  110 | Case #8:        : Accepted      00.00 sec       600 KB  1031 B  116 B   08.in
      |                                                                         ^~~~~
main.c:111:6: error: stray '#' in program
  111 | Case #9:        : Accepted      00.33 sec       600 KB  22392494 B      5 B     09.in
      |      ^
main.c:111:81: error: invalid suffix "in" on floating constant
  111 | Case #9:        : Accepted      00.33 sec       600 KB  22392494 B      5 B     09.in
      |                                                                                 ^~~~~
main.c:112:6: error: stray '#' in program
  112 | Case #10:       : Accepted      00.32 sec       31788 KB        25527813 B      1288799 B       10.in
      |      ^
main.c:112:97: error: invalid suffix "in" on floating constant
  112 | Case #10:       : Accepted      00.32 sec       31788 KB        25527813 B      1288799 B       10.in
      |                                                                                                 ^~~~~
main.c:115:13: error: stray '#' in program
  115 | Judge Input #1 ( in1.txt | 88 B)                Judge Output #1 ( out1.txt | 2 B)
      |             ^
main.c:115:62: error: stray '#' in program
  115 | Judge Input #1 ( in1.txt | 88 B)                Judge Output #1 ( out1.txt | 2 B)
      |                                                              ^