Submission #872408

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8724082023-11-13 04:52:44racsosabeXOR Sum (info1cup17_xorsum)C++14
56 / 100
1702 ms33172 KiB
#include<bits/stdc++.h>
using namespace::std;
const int N = 1000000 + 5;
int n;
int a[N];
vector<pair<int, int>> parse(vector<int> &v) {
int l = 0;
vector<pair<int, int>> res;
while(l < v.size()) {
int r = l;
while(r < v.size() and v[l] == v[r]) r += 1;
res.emplace_back(v[l], r - l);
l = r;
}
return res;
}
long long get_crossed(vector<pair<int, int>> a, vector<pair<int, int>> b, int m) {
int sum_a = 0, sum_b = 0;
for(auto x : a) sum_a += x.second;
for(auto x : b) sum_b += x.second;
long long res = 1ll * sum_a * sum_b;
int at = b.size() - 1;
int sum = 0;
for(auto x : a) {
if(x.first == 0) continue;
int want = m - x.first;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

xorsum.cpp: In function 'std::vector<std::pair<int, int> > parse(std::vector<int>&)':
xorsum.cpp:12:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |  while(l < v.size()) {
      |        ~~^~~~~~~~~~
xorsum.cpp:14:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |   while(r < v.size() and v[l] == v[r]) r += 1;
      |         ~~^~~~~~~~~~
xorsum.cpp: In function 'long long int get_pairs(std::vector<std::pair<int, int> >, int)':
xorsum.cpp:42:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |  for(int i = 0; i < v.size(); i++) suffix_sum.emplace_back(v[i].second);
      |                 ~~^~~~~~~~~~
xorsum.cpp:47:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |  for(int i = 0; i < v.size(); i++) {
      |                 ~~^~~~~~~~~~
xorsum.cpp: In function 'int main()':
xorsum.cpp:75:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   75 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
xorsum.cpp:78:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   78 |   scanf("%d", a + i);
      |   ~~~~~^~~~~~~~~~~~~
#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...