Submission #541569

#TimeUsernameProblemLanguageResultExecution timeMemory
541569AmirElarbiLast supper (IOI12_supper)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define vi vector<int> #define ve vector #define ll long long #define vf vector<float> #define vll vector<pair<ll,ll>> #define ii pair<int,int> #define pll pair<ll,ll> #define vvi vector<vi> #define vii vector<ii> #define gii greater<ii> #define pb push_back #define mp make_pair #define fi first #define se second #define INF 2e9+5 #define eps 1e-7 #define eps1 1e-25 #define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define MAX_A 1e5+5 #define V 450 using namespace std; const int MOD = 1e9; const int nax = 5e3+5; //#include "assistant.h" bool vis[nax]; int c[nax]; int GetRequest(int i){ return c[i]; } void Assist(string a, int n, int k, int r) { vi vals; int i; for (i = 0; i < n; i++) { int cur = 0; for (int j = 0; j < 13; ++j) { if(a[i*13 + j] == '1'){ cur += (int)(pow(2,12-j)+eps ); } } vals.pb(cur); } vi sch(n+1,0); for (int i = 0; i < k; ++i) { sch[i] = 1; } for (int i = 0; i < n; ++i) { int req = GetRequest(i); if(sch[req]) continue; int rem = 0; memset(vis,0,sizeof vis); for (int j = i+1; j < n; ++j) { if(!vis[vals[j]] && sch[vals[j]]){ vis[vals[j]] = 1; rem = vals[j]; } } for (int j = 0; j < n; ++j) { if(sch[j] && !vis[j]){ rem = j; break; } } sch[rem] = 0; sch[req] = 1; cout << rem << " " << req << endl; } } int main(){ optimise; #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int n,k,m; cin >> n >> k >> m; for (int i = 0; i < n; ++i) { cin >> c[i]; } string a = "0000000000010000000000001100000000001000000000000100000000000000100000000000000000000000011"; Assist(a, n, k, a.size()); }
#include <bits/stdc++.h> #define vi vector<int> #define ve vector #define ll long long #define vf vector<float> #define vll vector<pair<ll,ll>> #define ii pair<int,int> #define pll pair<ll,ll> #define vvi vector<vi> #define vii vector<ii> #define gii greater<ii> #define pb push_back #define mp make_pair #define fi first #define se second #define INF 2e9+5 #define eps 1e-7 #define eps1 1e-25 #define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define MAX_A 1e5+5 #define V 450 using namespace std; const int MOD = 1e9; const int nax = 5e3+5; #include "assistant.h" void Assist(unsigned char *a, int n, int k, int r) { vi vals; int i; for (i = 0; i < n; i++) { int cur = 0; for (int j = 0; j < 13; ++j) { if(a[i*13 + j] == '1'){ cur += (int)(pow(2,12-j)+eps ); } } vals.pb(cur); } vi sch(n+1,0); for (int i = 0; i < k; ++i) { sch[i] = 1; } for (int i = 0; i < n; ++i) { int req = GetRequest(); if(sch[req]) continue; int rem = 0; memset(vis,0,sizeof vis); for (int j = i+1; j < n; ++j) { if(!vis[vals[j]] && sch[vals[j]]){ vis[vals[j]] = 1; rem = vals[j]; } } for (int j = 0; j < n; ++j) { if(sch[j] && !vis[j]){ rem = j; break; } } sch[rem] = 0; sch[req] = 1; PutBack(rem); } }

Compilation message (stderr)

advisor.cpp: In function 'int main()':
advisor.cpp:76:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   76 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
advisor.cpp:77:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   77 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccLS3QEE.o: in function `main':
advisor.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccobALBB.o:advisor_grader.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccobALBB.o: in function `main':
advisor_grader.cpp:(.text.startup+0xe6): undefined reference to `ComputeAdvice(int*, int, int, int)'
collect2: error: ld returned 1 exit status

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:49:14: error: 'vis' was not declared in this scope; did you mean 'vii'?
   49 |       memset(vis,0,sizeof vis);
      |              ^~~
      |              vii