Блог пользователя ReTai-Hieu

Автор ReTai-Hieu, история, 2 года назад, По-английски

This morning, when I compile this code:

#include<bits/stdc++.h>
#define ii pair <int,int>
#define fi first
#define se second
#define int long long
#define double long double
#define endl '\n'
using namespace std;

map <ii, int> countPoint[10];
set <ii> listPair;

signed main(){
    //freopen("input.INP", "r", stdin);
    //freopen("output.OUT", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // cout << countPoint[3][{1,3}];
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++){
        int a, b;
        cin >> a >> b;
        int count = 0;
        int x = a;
        int y = b;
        cout << "Point: " << a << " " << b << endl;
        if (a != 0 or b != 0){
            while(1){
                if (a > 0 and b >= 0){
                    break;
                }
                count++;
                int a0 = a, b0 = b;
                a = b0;
                b = -a0;
                cout << a << " " << b << endl; 
            }
            x = a;
            y = b;
            int gcd = __gcd(a,b);
            x /= gcd;
            y /= gcd;
        }
        countPoint[count][make_pair(x,y)]++;
        listPair.insert({x,y});
    }
    int ans = 0;
    for (auto i: listPair){
        ans += countPoint[0][i] * countPoint[1][i];
        ans += countPoint[1][i] * countPoint[2][i];
        ans += countPoint[2][i] * countPoint[3][i];
        ans += countPoint[3][i] * countPoint[0][i];
    }
    cout << ans;
    return 0;
}

I got this weird error

0  0x1003e81a0  __assert_rtn + 140
1  0x10026fa8c  mach_o::relocatable::Parser<arm64>::parse(mach_o::relocatable::ParserOptions const&) + 4536
2  0x100241d38  mach_o::relocatable::Parser<arm64>::parse(unsigned char const*, unsigned long long, char const*, long, ld::File::Ordinal, mach_o::relocatable::ParserOptions const&) + 148
3  0x1002aa4ac  ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 1468
4  0x1002ad360  ___ZN2ld4tool10InputFilesC2ER7Options_block_invoke + 56
5  0x1a67101f4  _dispatch_client_callout2 + 20
6  0x1a6724f8c  _dispatch_apply_invoke_and_wait + 224
7  0x1a672426c  _dispatch_apply_with_attr_f + 1152
8  0x1a672447c  dispatch_apply + 108
9  0x1002ad1f4  ld::tool::InputFiles::InputFiles(Options&) + 616
10  0x10022f6c0  main + 552
A linker snapshot was created at:
        /tmp/prac-2022-09-16-202054.ld-snapshot
ld: Assertion failed: (_file->_atomsArrayCount == computedAtomCount && "more atoms allocated than expected"), function parse, file macho_relocatable_file.cpp, line 2061.
collect2: error: ld returned 1 exit status

I use MacOS Monterey, Command Line Tools for Xcode 14, and Homebrew GCC 12.2.0 If some of you got this you can do this to fix it

  • Проголосовать: нравится
  • +16
  • Проголосовать: не нравится

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by ReTai-Hieu (previous revision, new revision, compare).