Submission #314190

#TimeUsernameProblemLanguageResultExecution timeMemory
314190ShiftyBlockArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define f first #define s second #define pii pair<int, int> #define long long long #define v vector #define rep(i,a,b) for(int i=a; i<b; i++) void setIO(string name, int submit) { if (submit) { ios_base::sync_with_stdio(0); cin.tie(0); freopen((name + ".in").c_str(), "r", stdin); freopen((name + ".out").c_str(), "w", stdout); } else{ ios_base::sync_with_stdio(0); cin.tie(0); } } int N; int main() { setIO("", 0); cin>>N; int arr[N]; for (int i = 0; i < N; ++i) {cin>>arr[i]; } int total=0; for (int i = 0; i < N; ++i) { if(arr[i]==0) continue; int free=0; int end=-1; rep(j,i+1,N){ if(arr[j]==-arr[i]){ end=j; break; } if(arr[j]==0) free++; } arr[end]=0; if(arr[i]<0) total--; total+=end-i; } cout<<total<<endl; return 0; }

Compilation message (stderr)

shoes.cpp: In function 'void setIO(std::string, int)':
shoes.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((name + ".in").c_str(), "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
shoes.cpp:14:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   14 |         freopen((name + ".out").c_str(), "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ccBSSh9D.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc2vIJmj.o:shoes.cpp:(.text.startup+0x0): first defined here
/tmp/ccBSSh9D.o: In function `main':
grader.cpp:(.text.startup+0x26a): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status