Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals), problem: (C) Jury Marks Solution In C/C++

By |2017-07-24T17:45:19+00:00July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , , , |

#include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin>>k>>n; int t; int arr[k]; set<int>c; for(int i=0;i<k;i++){ cin>>t; arr[i]= arr[i-1]+t; } for(int i=0;i<n;i++){ cin>>t; set<int>mmp; for(int j=0;j<k;j++){ int x = t-arr[j]; if(!i||(c.find(x) != c.end())){ mmp.insert(x); } } c =mmp; } cout<<c.size(); return 0; }