Submission #768044

#TimeUsernameProblemLanguageResultExecution timeMemory
768044Trisanu_DasStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
337 ms22992 KiB
#include <bits/stdc++.h> using namespace std; int n, i, x; map<int,int>p , a; int main(){ cin >> n; while(i < n)cin >> a[i], p[a[i++]] = i; i=0; while(i<n, x=a[i]) while(i<n&&p[x]>=i)cout<<x<<"\n",i++; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:7:45: warning: operation on 'i' may be undefined [-Wsequence-point]
    7 |     cin >> n; while(i < n)cin >> a[i], p[a[i++]] = i;
      |                                            ~^~
Main.cpp:7:45: warning: operation on 'i' may be undefined [-Wsequence-point]
Main.cpp:9:12: warning: left operand of comma operator has no effect [-Wunused-value]
    9 |     while(i<n, x=a[i]) while(i<n&&p[x]>=i)cout<<x<<"\n",i++;
      |           ~^~
Main.cpp:9:17: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
    9 |     while(i<n, x=a[i]) while(i<n&&p[x]>=i)cout<<x<<"\n",i++;
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...