Submission #784521

#TimeUsernameProblemLanguageResultExecution timeMemory
784521LyricallyStone Arranging 2 (JOI23_ho_t1)C++17
25 / 100
13 ms3900 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define pii pair<int,int> #define pb push_back #define rep(i,n) for(int i=0;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) int read(){int x;scanf("%lld",&x);return x;} void print(int x){printf("%lld\n",x);} void file(string s) { freopen((s+".in").c_str(),"r",stdin); freopen((s+".out").c_str(),"w",stdout); } const int mod=998244353; int cl[2005]; signed main() { int n=read(); int a[n]; rep(i,n){a[i]=read();} rep(i,n) { bool fl=0; for(int j=i-1;j>=0;j--) { if(cl[j]==a[i]) { for(int k=j+1;k<=i;k++){cl[k]=a[i];} fl=1;break; } } if(!fl) { cl[i]=a[i]; } } rep(i,n) { cout<<cl[i]<<endl; } return 0; }

Compilation message (stderr)

Main.cpp: In function 'long long int read()':
Main.cpp:8:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 | int read(){int x;scanf("%lld",&x);return x;}
      |                  ~~~~~^~~~~~~~~~~
Main.cpp: In function 'void file(std::string)':
Main.cpp:12:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  freopen((s+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:13:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  freopen((s+".out").c_str(),"w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...