Submission #741805

#TimeUsernameProblemLanguageResultExecution timeMemory
741805jamezzzStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
294 ms14232 KiB
#include <bits/stdc++.h> using namespace std; #define sf scanf #define pf printf #define maxn 200005 int n,a[maxn]; map<int,int> la; int main(){ sf("%d",&n); for(int i=1;i<=n;++i){ sf("%d",&a[i]); la[a[i]]=i; } int cur=1; while(cur<=n){ for(int i=cur;i<=la[a[cur]];++i){ pf("%d\n",a[cur]); } cur=la[a[cur]]+1; } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:13:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  sf("%d",&n);
      |    ^
Main.cpp:15:5: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   sf("%d",&a[i]);
      |     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...