Submission #1065169

#TimeUsernameProblemLanguageResultExecution timeMemory
1065169ttttttttttttthStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
172 ms18448 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long 

const int N = 2e5+5;

int n,a[N];
map<int,int> pos;

signed main () {
    if (fopen("MARBEL.inp", "r")){
        freopen("MARBEL.inp", "r", stdin);
        freopen("MARBEL.out", "w", stdout);
    }
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n ;
    for(int i=1;i<=n;i++){
        cin >> a[i];
        pos[a[i]] = i;
    }
    for(int i=1;i<=n;){
        int x = pos[a[i]];
        while(i <= x){
            cout << a[x] << " ";
            i++;
        }
    }
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:12:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         freopen("MARBEL.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:13:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         freopen("MARBEL.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...