답안 #655060

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
655060 2022-11-02T22:56:54 Z Richem 원 고르기 (APIO18_circle_selection) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
 
const int MAX_ALED = 1e5+42;
 
struct Aled{
    int xCentre, yCentre, rayon, id;
 
    bool ragequit = false;
 
    bool intersecte(Aled autre) {
        int x = xCentre - autre.xCentre, y = yCentre - autre.yCentre;
        return (x*x+y*y) <= (rayon + autre.rayon) * (rayon + autre.rayon);
    }
    bool operator<(Aled autre) {
        if(rayon == autre.rayon)
            return id < autre.id;
        return rayon > autre.rayon;
    }
};
 
struct Position{
    long long int x,y;
 
    long long int getId() {
        return (x << 32) + y;
    }
};
 
int nbAled;
Aled aled[MAX_ALED];
Aled triRayon[MAX_ALED];
 
void input() {
    cin >> nbAled;
 
    for(int iAled = 0; iAled < nbAled; iAled++) {
        cin >> aled[iAled].xCentre >> aled[iAled].yCentre >> aled[iAled].rayon;
        aled[iAled].id = iAled;
    }
    sort(aled, aled + nbAled);
}
 
unordered_map<long long int, vector<int>> enfer;
Position quelCase[MAX_ALED];
 
void calcGrille(int taille) {
    enfer.clear();
    for(int cur = 0; cur < nbAled; cur++) {
        int xCase = aled[cur].xCentre / taille, yCase = aled[cur].yCentre / taille;
 
        Position caseCur = {xCase, yCase};
 
        enfer[caseCur.getId()].push_back(cur);
        quelCase[cur] = {xCase, yCase};
    }
}
 
bool retire[MAX_ALED] = {0};
int rep[MAX_ALED];
 
int tailleGrille;
 
int main() {
    input();
    tailleGrille = (1 << 20);
    
    for(int curCercle = 0; curCercle < nbAled; curCercle++) {
        if(retire[curCercle])
            continue;
 
        while(aled[curCercle].rayon < tailleGrille) {
            tailleGrille /= 2;
            calcGrille(tailleGrille);
        }
 
        for(auto deltaX : {-3,-2, -1, 0, 1, 2,3}) {
            for(auto deltaY : {-3,-2, -1, 0, 1, 2,3}) {
                int xCaseNouv = quelCase[curCercle].x + deltaX, yCaseNouv = quelCase[curCercle].y + deltaY;
                Position caseNouv = {xCaseNouv, yCaseNouv};
 
                for(auto autreCercle : enfer[caseNouv.getId()]) {
                    if(!retire[autreCercle] && aled[curCercle].intersecte(aled[autreCercle])) {
                        retire[autreCercle] = 1;
                        rep[aled[autreCercle].id] = aled[curCercle].id+1;
                    }
                }
            }
        }
    }
 
    for(int curCercle = 0; curCercle < nbAled; curCercle++) {
        cout << rep[curCercle] << " ";
    }
}

Compilation message

circle_selection.cpp:77:2: error: extended character   is not valid in an identifier
   77 |         for(auto deltaX : {-3,-2, -1, 0, 1, 2,3}) {
      |  ^
circle_selection.cpp:77:5: error: extended character   is not valid in an identifier
   77 |         for(auto deltaX : {-3,-2, -1, 0, 1, 2,3}) {
      |    ^
circle_selection.cpp:77:8: error: extended character   is not valid in an identifier
   77 |         for(auto deltaX : {-3,-2, -1, 0, 1, 2,3}) {
      |      ^
circle_selection.cpp:77:11: error: extended character   is not valid in an identifier
   77 |         for(auto deltaX : {-3,-2, -1, 0, 1, 2,3}) {
      |        ^
circle_selection.cpp:78:2: error: extended character   is not valid in an identifier
   78 |             for(auto deltaY : {-3,-2, -1, 0, 1, 2,3}) {
      |  ^
circle_selection.cpp:78:5: error: extended character   is not valid in an identifier
   78 |             for(auto deltaY : {-3,-2, -1, 0, 1, 2,3}) {
      |    ^
circle_selection.cpp:78:8: error: extended character   is not valid in an identifier
   78 |             for(auto deltaY : {-3,-2, -1, 0, 1, 2,3}) {
      |      ^
circle_selection.cpp:78:11: error: extended character   is not valid in an identifier
   78 |             for(auto deltaY : {-3,-2, -1, 0, 1, 2,3}) {
      |        ^
circle_selection.cpp:78:14: error: extended character   is not valid in an identifier
   78 |             for(auto deltaY : {-3,-2, -1, 0, 1, 2,3}) {
      |          ^
circle_selection.cpp:78:17: error: extended character   is not valid in an identifier
   78 |             for(auto deltaY : {-3,-2, -1, 0, 1, 2,3}) {
      |            ^
circle_selection.cpp: In function 'int main()':
circle_selection.cpp:77:2: error: '\U000000a0' was not declared in this scope
   77 |         for(auto deltaX : {-3,-2, -1, 0, 1, 2,3}) {
      |  ^
circle_selection.cpp:77:53: error: expected primary-expression before ')' token
   77 |         for(auto deltaX : {-3,-2, -1, 0, 1, 2,3}) {
      |                                                 ^