Submission #974405

#TimeUsernameProblemLanguageResultExecution timeMemory
974405lucriCrayfish scrivener (IOI12_scrivener)C++17
Compilation error
0 ms0 KiB
#include <stdlib.h> #include <stdio.h> #include <assert.h> #define inbuf_len 1 << 16 #define outbuf_len 1 << 16 #include<bits/stdc++.h> std::string ans[1000010]; int nr; void Init() { return; } void TypeLetter(char L) { ++nr; ans[nr]=ans[nr-1]; ans[nr]+=L; } void UndoCommands(int U) { ++nr; ans[nr]=ans[nr-U-1]; } char GetLetter(int P) { return ans[nr][P]; } int main() { Init(); int cmd_num; scanf("%d", &cmd_num); int i; for (i = 0; i < cmd_num; i++) { char cmd; scanf(" %c", &cmd); if (cmd == 'T') { char letter; scanf(" %c", &letter); TypeLetter(letter); } else if (cmd == 'U') { int number; scanf("%d", &number); UndoCommands(number); } else if (cmd == 'P') { int index; char letter; scanf("%d", &index); letter = GetLetter(index); printf("%c\n", letter); } } puts("Let's test for cheating!!"); return 0; }

Compilation message (stderr)

scrivener.cpp: In function 'int main()':
scrivener.cpp:36:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |   scanf("%d", &cmd_num);
      |   ~~~~~^~~~~~~~~~~~~~~~
scrivener.cpp:41:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |     scanf(" %c", &cmd);
      |     ~~~~~^~~~~~~~~~~~~
scrivener.cpp:44:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |       scanf(" %c", &letter);
      |       ~~~~~^~~~~~~~~~~~~~~~
scrivener.cpp:49:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |       scanf("%d", &number);
      |       ~~~~~^~~~~~~~~~~~~~~
scrivener.cpp:55:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |       scanf("%d", &index);
      |       ~~~~~^~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccprKZMt.o: in function `main':
scrivener.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc2tirZs.o:grader.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status