/ SeriousOJ /

Record Detail

Compile Error

In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from foo.cc:9:
/usr/include/c++/13/bits/allocator.h: In destructor 'std::_Vector_base<int, std::allocator<int> >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = int]': target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~

Code

#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

// Based on:
// https://judge.yosupo.jp/submission/179750
// Enumerate Quotients
// https://judge.yosupo.jp/problem/enumerate_quotients
#include<bits/stdc++.h>

using namespace std;

// vector<long long> Enu_quo(long long n){
//   vector<long long> head;
//   vector<long long> tail;
//   for(long long i=1;i*i<=n;i++){
//     head.push_back(i);
//     tail.push_back(n/i);
//   }
//   if(head.back()==tail.back()){tail.pop_back();}
//   for(long long i=tail.size()-1;i>=0;i--){head.push_back(tail[i]);}
//   return head;
// }

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while(t>0){
    t--;
    int n;
    cin >> n;

    vector<int> head;
    vector<int> tail;
    for(int i=1;i*i<=n;i++){
      head.push_back(i);
      tail.push_back(n/i);
    }
    if(head.back()==tail.back()){tail.pop_back();}
    for(int i=tail.size()-1;i>=0;i--){head.push_back(tail[i]);}

    long long res=0;
    for(int i=0;i<((long long)head.size())-1;i++){
      long long del=((n/head[i])-(n/head[i+1]));
      del*=head[i];
      res+=del;
    }
    cout << res << "\n";
  }
  return 0;
}

Information

Submit By
Type
Submission
Problem
P1207 D2. GCD equal Absolute Value (Hard Version)
Contest
Educational Round 1
Language
C++17 (G++ 13.2.0)
Submit At
2025-07-14 15:57:18
Judged At
2025-07-14 15:57:18
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes