Submission #1180011

#TimeUsernameProblemLanguageResultExecution timeMemory
1180011pcheloveksHomecoming (BOI18_homecoming)C++20
0 / 100
19 ms12100 KiB
//#pragma GCC optimize("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4") //#pragma GCC target("bmi,bmi2,popcnt,lzcnt") #include "homecoming.h" #include <iostream> #include <vector> #include <string> #include <map> #include <set> #include <cmath> #include <fstream> #include <climits> #include <queue> #include <algorithm> #include <stdint.h> #include <stack> #include <iomanip> #include <unordered_set> #include <unordered_map> #include <cstring> // Для memset #define endl '\n' using namespace std; typedef long long ll; typedef long double ld; typedef pair <ll, ll> pii; typedef pair <ld, ld> pdd; const ll DIM = 700007; const ll MXMASK = (1 << 21); const ll INF = 1e18; const ll mod = 998244353; const ld eps = 0.00000000001; const ld gr = (sqrt(5) + 1) / 2; const ll offset = 10000; const ll Bits = 20; const ll dx[4] = { 1, 0, -1, 0 }; const ll dy[4] = { 0, 1, 0, -1 }; FILE* stream; long long int solve(int N, int K, int* A, int* B) { vector < ll > p(2 * N + 1, 0); long long int res = 0; p[0] = B[0]; for (int i = 1; i < 2 * N; i++) { if (i < N) p[i] = p[i - 1] + B[i]; else p[i] = p[i - 1] + B[i - N]; } if(A[0] - p[K] >= 0) res = A[0] - p[K - 1]; for (int i = 1; i < N; i++) { if (-p[i + K - 1] + p[i - 1] + A[i] >= 0) res += -p[i + K - 1] + p[i - 1] + A[i]; } return res; } /* 3 2 40 80 100 140 0 20 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...