제출 #1107243

#제출 시각아이디문제언어결과실행 시간메모리
1107243vjudge1은행 (IZhO14_bank)C++17
0 / 100
1 ms4432 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; #define pb push_back #define int long long #define no "NO\n" #define yes "YES\n" #define ew "\n" #define all(x) x.begin(), x.end() #define F first #define S second #define float long double #define len(x) (int)x.size() #define macvin \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); using pii = pair<int, int>; using ld = long double; const int N = 2e6 + 7; const int mod = 1e9 + 7; const int inf = 1e18 + 7; const int hh = 1e2 + 70; const int MAX = 200007; const int maxn = 1e6 + 7; int n, q; int a[N], b[N]; int used[N]; int pref[N]; bool solveeed = 0; void cdq(int l, int r, int x) { if (l >= r) { return; } if (pref[r] - pref[l - 1] == x) { solveeed = 1; return; } int md = (l + r) / 2; cdq(l, md, x); cdq(md + 1, r, x); } void iamgoingto10of10() { cin >> n >> q; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 1; i <= q; i++) { cin >> b[i]; pref[i] = pref[i - 1] + b[i]; } bool ans = 1; for (int i = 1; i <= n; i++) { solveeed = 0; cdq(1, n, a[i]); if (!solveeed) { ans = 0; } } if (ans) { cout << yes; } else { cout << no; } } signed main() { macvin int T = 1; // cin >> T; while (T--) { iamgoingto10of10(); } } /* ⣿⣿⣿⣿⣿⣿⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⣤⣤⠤⠤⠀⠒⠶⣀⠀⠀⠀⠈⣿⣿⣿⡿⠁ ⣿⣿⣿⣿⣿⡗⠈⠀⠀⠀⣠⢀⣀⠀⣀⠀⢀⡀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠶⠚⣛⣉⠠⠀⣄⣀⠀⠀⠀⠀⠀⠀⠀⢿⣿⡿⠁⠀ ⠹⣯⢼⣿⣿⣿⠀⠀⣰⣷⢴⠳⠟⠛⠙⢻⣛⣟⣓⡋⠢⠀⢀⠀⠀⠀⠀⠀⠀⠀⠠⣪⢵⣶⣶⣶⠦⣌⡙⠀⠀⠀⠀⠀⠀⢸⣿⠃⠀⠀ ⠀⣿⣼⡟⣿⣿⠀⢀⠢⠁⠀⣰⣜⣿⢿⣿⠿⢿⠟⢕⠢⠀⠃⠀⠀⠀⠀⠀⠀⠀⠐⠁⠈⠒⠒⠁⠀⠈⠅⠀⠀⠀⠀⠀⠀⡘⠟⢀⠀⠀ ⠲⣿⢧⡃⣽⣿⠂⠀⠀⠀⠀⠉⠟⠉⠠⠈⠁⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠺⠀⠀⠀⠀ ⠀⡹⠸⣇⢸⣿⡅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⠆⠀⠀⠀ ⢠⡇⠀⣿⡘⢿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀ ⣼⣯⡈⠈⢯⠎⠻⡜⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀ ⣿⣷⣿⣆⢘⣆⠀⣷⢁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣷⠮⠁⠀⠀ ⣿⣿⣿⣿⣶⣌⠦⣜⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⠀⣀⡄⠀⠀⠀⣰⣤⡠⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⢋⠄⠀⢀⢠ ⣿⣿⣿⣿⣿⣿⣷⣎⣗⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢛⠙⠛⡈⠀⠜⠈⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡂⢠⡴⣏⢧ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣷⢿⡱⣏⠖ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠠⢤⣤⣤⣤⣄⣀⣠⣀⣠⠶⠴⠦⠤⠒⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡿⣏⠷⠈⠌ ⠀⠌⠙⠻⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢺⠟⠀⠀⠀⠀ ⠀⠀⠀⠀⢉⠻⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠀⡈⠇⠀⠀⠀⠀ ⠀⠀⠀⠀⠈⠉⠙⠻⢿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠇⢠⠃⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣦⡀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠊⠁⠀⢠⠎⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⢹⣿⣞⡄⡀⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠎⠀⠀⣀⠔⠁⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣈⢻⣿⣧⣗⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⢖⡡⠔⣠⡰⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⣼⣿⡏⠈⣿⡿⠁⠀⠀⠽⢿⣿⣾⣽⡷⣦⢤⡀⡄⣀⠀⡀⡀⠄⠔⣒⢱⣜⣮⡴⠚⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⣾⣿⣿⡇⠀⢿⠁⠀⠀⠀⠀⠈⠙⣿⣿⣿⣿⣯⣷⡬⣫⡀⡱⣀⣖⣼⣾⣿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠻⡟⠙⡷⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠙⠿⣿⣿⣿⣿⣷⣿⣿⣿⣿⠿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⡇⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⣻⣟⢿⣿⠟⣋⡀⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠹⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡾⢛⣽⣴⢴⣟⢙⣿⣦⡙⠑⠓⠙⠃⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...