Submission #233577

#TimeUsernameProblemLanguageResultExecution timeMemory
233577BasilhijazArranging Shoes (IOI19_shoes)Java
Compilation error
0 ms0 KiB
#include "shoes.h" using namespace std; typedef long long ll; #define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define mp make_pair #define pb push_back #define lp(i,s,f) for(ll i = s; i < ll(f); i++) #define inF freopen("input.in", "r", stdin); #define outF freopen("output.in", "w", stdout); #define endl '\n' #define MOD 1000000007 long long count_swaps(vector<int> s) { int n = s.size(); vector<pair<int, int> > v; bool done[n]; for(int i = 0; i < n; i++){ done[n] = 0; } for(int i = 0; i < n; i++){ if(!done[i]){ int serach = s[i]*-1; int first = -1; int second = -1; first = i; for(int j = i + 1; j < n; j++){ if(s[j] == serach){ second = j; done[j] = 1; break; } } v.pb({first, second}); } } ll ans = 0; for(int i = 0; i < n; i++){ done[n] = 0; } for(int i = 0; i < n/2; i++){ if(s[v[i].first] > s[v[i].second]){ ans++; } } for(int i = 0; i < n/2; i++){ done[v[i].second] = 1; for(int j = v[i].first + 1; j < v[i].second; j++){ if(!done[j])ans++; } } return ans; }

Compilation message (stderr)

shoes.java:1: error: illegal character: '#'
#include "shoes.h"
^
shoes.java:1: error: class, interface, or enum expected
#include "shoes.h"
         ^
shoes.java:4: error: class, interface, or enum expected
typedef long long ll;
^
shoes.java:6: error: illegal character: '#'
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
^
shoes.java:6: error: class, interface, or enum expected
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
        ^
shoes.java:6: error: class, interface, or enum expected
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
                                               ^
shoes.java:6: error: class, interface, or enum expected
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
                                                           ^
shoes.java:7: error: illegal character: '#'
#define mp make_pair
^
shoes.java:7: error: class, interface, or enum expected
#define mp make_pair
        ^
shoes.java:8: error: illegal character: '#'
#define pb push_back
^
shoes.java:9: error: illegal character: '#'
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
^
shoes.java:9: error: class, interface, or enum expected
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
                                ^
shoes.java:9: error: class, interface, or enum expected
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
                                           ^
shoes.java:10: error: illegal character: '#'
#define inF freopen("input.in", "r", stdin);
^
shoes.java:11: error: illegal character: '#'
#define outF freopen("output.in", "w", stdout);
^
shoes.java:11: error: class, interface, or enum expected
#define outF freopen("output.in", "w", stdout);
        ^
shoes.java:12: error: illegal character: '#'
#define endl '\n'
^
shoes.java:12: error: class, interface, or enum expected
#define endl '\n'
        ^
shoes.java:13: error: illegal character: '#'
#define MOD 1000000007
^
shoes.java:17: error: class, interface, or enum expected
    vector<pair<int, int> > v;
    ^
shoes.java:18: error: class, interface, or enum expected
    bool done[n];
    ^
shoes.java:19: error: class, interface, or enum expected
    for(int i = 0; i < n; i++){
    ^
shoes.java:19: error: class, interface, or enum expected
    for(int i = 0; i < n; i++){
                   ^
shoes.java:19: error: class, interface, or enum expected
    for(int i = 0; i < n; i++){
                          ^
shoes.java:21: error: class, interface, or enum expected
    }
    ^
shoes.java:22: error: class, interface, or enum expected
    for(int i = 0; i < n; i++){
                   ^
shoes.java:22: error: class, interface, or enum expected
    for(int i = 0; i < n; i++){
                          ^
shoes.java:25: error: class, interface, or enum expected
            int first = -1; int second = -1;
            ^
shoes.java:25: error: class, interface, or enum expected
            int first = -1; int second = -1;
                            ^
shoes.java:26: error: class, interface, or enum expected
            first = i;
            ^
shoes.java:27: error: class, interface, or enum expected
            for(int j = i + 1; j < n; j++){
            ^
shoes.java:27: error: class, interface, or enum expected
            for(int j = i + 1; j < n; j++){
                               ^
shoes.java:27: error: class, interface, or enum expected
            for(int j = i + 1; j < n; j++){
                                      ^
shoes.java:30: error: class, interface, or enum expected
                    done[j] = 1;
                    ^
shoes.java:31: error: class, interface, or enum expected
                    break;
                    ^
shoes.java:32: error: class, interface, or enum expected
                }
                ^
shoes.java:35: error: class, interface, or enum expected
        }
        ^
shoes.java:38: error: class, interface, or enum expected
    for(int i = 0; i < n; i++){
    ^
shoes.java:38: error: class, interface, or enum expected
    for(int i = 0; i < n; i++){
                   ^
shoes.java:38: error: class, interface, or enum expected
    for(int i = 0; i < n; i++){
                          ^
shoes.java:40: error: class, interface, or enum expected
    }
    ^
shoes.java:41: error: class, interface, or enum expected
    for(int i = 0; i < n/2; i++){
                   ^
shoes.java:41: error: class, interface, or enum expected
    for(int i = 0; i < n/2; i++){
                            ^
shoes.java:44: error: class, interface, or enum expected
        }
        ^
shoes.java:46: error: class, interface, or enum expected
    for(int i = 0; i < n/2; i++){
                   ^
shoes.java:46: error: class, interface, or enum expected
    for(int i = 0; i < n/2; i++){
                            ^
shoes.java:49: error: class, interface, or enum expected
        for(int j = v[i].first + 1; j < v[i].second; j++){
        ^
shoes.java:49: error: class, interface, or enum expected
        for(int j = v[i].first + 1; j < v[i].second; j++){
                                    ^
shoes.java:49: error: class, interface, or enum expected
        for(int j = v[i].first + 1; j < v[i].second; j++){
                                                     ^
shoes.java:51: error: class, interface, or enum expected
        }
        ^
shoes.java:54: error: class, interface, or enum expected
}
^
51 errors