Submission #557499

# Submission time Handle Problem Language Result Execution time Memory
557499 2022-05-05T11:54:28 Z MDSPro Sorting (IOI15_sorting) C++14
Compilation error
0 ms 0 KB
// MDSPro
// #include "sorting.h"
#include <bits/stdc++.h>

#define trav(i,n) for(int i = 0; i < (n); i++)
#define pb push_back
#define se second
#define fi first
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int,int>;
using vi = vector<int>;

const ld PI = 3.141592653589793;
const ll MOD = 1e9+7;
const int INF = 1e9;
const ll INFLL = 4e18;
const double EPS = 1e-9;
const int SIZE = 1000*1007;

int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
    // size of arrays x,y,p,q is m
    // size of attay s is n
    int ans = 0;
    for(int j = 0; j < n; ++j){
        int mn = s[j];
        int mni = j;
        for(int i = j+1; i < n; ++i){
            if(mn > s[i]) {
                mni = i;
                mn = s[i];
            }
        }
        swap(s[j],s[mni]);
        p[j] = j;
        q[j] = mni;
        
        ans++;
    }
    dd/0;
    for(int i = n; i < m; ++i) p[i] = q[i] = 0;
    return ans;
}
dje23jr

// int main(){
//     int n = 5;
//     int arr[] = {-2,-1,0,2,1};
    
//     for(int i: arr) cout << i << " ";
//     cout << endl << endl;
    
//     int m = 7;
//     int x[] = {0,0,0,0,0,0,0};
//     int y[] = {0,0,0,0,0,0,0};
//     int p[m] = {0};
//     int q[m] = {0};
    
//     int r = findSwapPairs(n,arr,m,x,y,p,q);
//     for(int i = 0; i < m; ++i){
//         cout << "swap " << p[i] << " and " << q[i] << ".\n";
//     }
// }

Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:43:5: error: 'dd' was not declared in this scope; did you mean 'ld'?
   43 |     dd/0;
      |     ^~
      |     ld
sorting.cpp:24:46: warning: unused parameter 'x' [-Wunused-parameter]
   24 | int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
      |                                          ~~~~^~~
sorting.cpp:24:55: warning: unused parameter 'y' [-Wunused-parameter]
   24 | int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
      |                                                   ~~~~^~~
sorting.cpp: At global scope:
sorting.cpp:47:1: error: 'dje23jr' does not name a type
   47 | dje23jr
      | ^~~~~~~