codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1323.md (3672B)


      1 Source: https://codeforces.com/blog/entry/74148
      2 
      3 Thanks for the participation!
      4 
      5 [1323A - Even Subset Sum Problem](/contest/1323/problem/A "Codeforces Round 626 (Div. 2, based on Moscow Open Olympiad in Informatics)") was authored and prepared by [vintage_Vlad_Makeev](/profile/vintage_Vlad_Makeev "International Grandmaster vintage_Vlad_Makeev")
      6 
      7 [1323B - Count Subrectangles](/contest/1323/problem/B "Codeforces Round 626 (Div. 2, based on Moscow Open Olympiad in Informatics)") was authored and prepared by [vintage_Vlad_Makeev](/profile/vintage_Vlad_Makeev "International Grandmaster vintage_Vlad_Makeev")
      8 
      9 [1322A - Unusual Competitions](/contest/1322/problem/A "Codeforces Round 626 (Div. 1, based on Moscow Open Olympiad in Informatics)") was authored by [vintage_Vlad_Makeev](/profile/vintage_Vlad_Makeev "International Grandmaster vintage_Vlad_Makeev") and prepared by [DebNatkh](/profile/DebNatkh "Candidate Master DebNatkh")
     10 
     11 [1322B - Present](/contest/1322/problem/B "Codeforces Round 626 (Div. 1, based on Moscow Open Olympiad in Informatics)") was authored by [meshanya](/profile/meshanya "Grandmaster meshanya") and prepared by [wrg0ababd](/profile/wrg0ababd "Expert wrg0ababd")
     12 
     13 [1322C - Instant Noodles](/contest/1322/problem/C "Codeforces Round 626 (Div. 1, based on Moscow Open Olympiad in Informatics)") was authored by [vintage_Vlad_Makeev](/profile/vintage_Vlad_Makeev "International Grandmaster vintage_Vlad_Makeev") and prepared by [ch_egor](/profile/ch_egor "International Grandmaster ch_egor")
     14 
     15 [1322D - Reality Show](/contest/1322/problem/D "Codeforces Round 626 (Div. 1, based on Moscow Open Olympiad in Informatics)") was authored by [voidmax](/profile/voidmax "International Grandmaster voidmax") and prepared by [okwedook](/profile/okwedook "Master okwedook")
     16 
     17 [1322E - Median Mountain Range](/contest/1322/problem/E "Codeforces Round 626 (Div. 1, based on Moscow Open Olympiad in Informatics)") was authored by [Sender](/profile/Sender "Expert Sender") and prepared by [grphil](/profile/grphil "Master grphil")
     18 
     19 [1322F - Assigning Fares](/contest/1322/problem/F "Codeforces Round 626 (Div. 1, based on Moscow Open Olympiad in Informatics)") was authored by [mingaleg](/profile/mingaleg "Candidate Master mingaleg"), [vintage_Vlad_Makeev](/profile/vintage_Vlad_Makeev "International Grandmaster vintage_Vlad_Makeev") and prepared by [KiKoS](/profile/KiKoS "Master KiKoS")
     20 
     21 Tutorial is loading...
     22 
     23 Tutorial is loading...
     24 
     25 **c++ code by gritukan**
     26 
     27 ```
     28 #include <bits/stdc++.h>
     29 
     30 using ll = long long;
     31 using ld = long double;
     32 using ull = unsigned long long;
     33 
     34 using namespace std;
     35 
     36 vector<ll> gao(vector<int> a) {
     37     int n = a.size();
     38     vector<ll> res(n + 1);
     39     int i = 0;
     40     while (i < n) {
     41         if (a[i] == 0) {
     42             i++;
     43             continue;
     44         }
     45 
     46         int j = i;
     47         while (j < n && a[j] == 1) {
     48             j++;
     49         }
     50         for (int len = 1; len <= j - i; len++) {
     51             res[len] += j - i - len + 1;
     52         }
     53         i = j;
     54     }
     55 
     56     return res;
     57 }
     58 
     59 int main() {
     60     ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
     61     int n, m;
     62     ll k;
     63     cin >> n >> m >> k;
     64     vector<int> a(n);
     65     vector<int> b(m);
     66     for (int& x : a) {
     67         cin >> x;
     68     }
     69     for (int& x : b) {
     70         cin >> x;
     71     }
     72 
     73     ll ans = 0;
     74 
     75     auto ga = gao(a);
     76     auto gb = gao(b);
     77     for (int i = 1; i < ga.size(); i++) {
     78         if (k % i == 0 && k / i <= m) {
     79             ans += ga[i] * gb[k / i];
     80         }
     81     }
     82 
     83     cout << ans << "\n";
     84     return 0;
     85 }
     86 ```
     87 
     88 Tutorial is loading...
     89 
     90 Tutorial is loading...
     91 
     92 Tutorial is loading...
     93 
     94 Tutorial is loading...
     95 
     96 Tutorial is loading...
     97 
     98 Tutorial is loading...