Submission #1148834

#TimeUsernameProblemLanguageResultExecution timeMemory
1148834kitkat12Circus (Balkan15_CIRCUS)C++20
0 / 100
4094 ms1464 KiB
#include <bits/stdc++.h> #include "circus.h" using namespace std; typedef long long ll; typedef pair<int,int> pii; #define mp make_pair #define pb push_back #define F first #define S second #define debug(x) std::cout << #x << ": " << x << "\n" #define all(v) v.begin(), v.end() #define li(i,a,b) for (int (i) = (a); (i) < (b); (i)++) #define endl '\n' #define mem(name,val) memset(name,val,sizeof(name)) #define min(a,b) (a<=b ? a : b) #define max(a,b) (a>=b ? a : b) //using u64 = uint64_t; //using u128 = __uint128_t; const int nmax = 2003; vector<int> p, dp; int n,m; void init(int N, int M, int P[]){ n = N; m = M; sort(P,P+N); li(i,0,n)p.pb(P[i]); dp.assign(n,INT_MAX); dp[n-1] = m-p[n-1]; for(int i = n-2; i>=0; i--){ dp[i] = m-p[i]; for(int j = i+1; j<n; j++){ if(p[j]-p[i] < dp[j]) continue; dp[i] = min(dp[i], p[j]-p[i]); } } } int minLength(int d){ int idx = lower_bound(all(p),d) - p.begin(); ll res = abs(d-m); li(i,idx,n){ if(p[i]-d<dp[i]) continue; res = min(res, p[i]-d); } return res; }

Compilation message (stderr)

grader.cpp: In function 'int main()':
grader.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d%d", &N, &M);
      |         ~~~~~^~~~~~~~~~~~~~~~
grader.cpp:18:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |                 scanf("%d", &P[i]);
      |                 ~~~~~^~~~~~~~~~~~~
grader.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         scanf("%d", &Q);
      |         ~~~~~^~~~~~~~~~
grader.cpp:23:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |                 scanf("%d", &d);
      |                 ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...