Rezultati

Up. imeNalogaJezikRezultatČas oddaje
pitoni-2017 Črte C++ 100/100OK 20. apr '17 @ 19:45

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 3,113 MiB 0,893 s OK
#2 10/10 3,688 MiB 0,753 s OK
#3 10/10 336,117 MiB 1,746 s OK
#4 10/10 955,184 MiB 1,173 s OK
#5 10/10 885,809 MiB 9,206 s OK
#6 10/10 3,344 MiB 2,031 s OK
#7 10/10 3,770 MiB 2,037 s OK
#8 10/10 10,852 MiB 2,336 s OK
#9 10/10 524,703 MiB 2,988 s OK
#10 10/10 1029,094 MiB 7,653 s OK

Ocenjevani program (crte1.cpp):
#include <iostream>
#include <algorithm>
#include <array>
#include <complex>
#include <cmath>
#include <functional>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <utility>

using namespace std;

typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<double> vd;

#define max 20000
#define N  (max*max + max*max + 1)

#define allmod (1024*49*9)

short inv9[9] = {0, 1, 2, 0, 3, 4, 0, 5, 6};
short inv1024[1024] = {0, 1, 2, 0, 3, 4, 0, 0, 5, 6, 7, 0, 0, 8, 0, 0, 9, 10, 11, 0, 12, 13, 0, 0, 0, 14, 15, 0, 0, 16, 0, 0, 17, 18, 19, 0, 20, 21, 0, 0, 22, 23, 24, 0, 0, 25, 0, 0, 0, 26, 27, 0, 28, 29, 0, 0, 0, 30, 31, 0, 0, 32, 0, 0, 33, 34, 35, 0, 36, 37, 0, 0, 38, 39, 40, 0, 0, 41, 0, 0, 42, 43, 44, 0, 45, 46, 0, 0, 0, 47, 48, 0, 0, 49, 0, 0, 0, 50, 51, 0, 52, 53, 0, 0, 54, 55, 56, 0, 0, 57, 0, 0, 0, 58, 59, 0, 60, 61, 0, 0, 0, 62, 63, 0, 0, 64, 0, 0, 65, 66, 67, 0, 68, 69, 0, 0, 70, 71, 72, 0, 0, 73, 0, 0, 74, 75, 76, 0, 77, 78, 0, 0, 0, 79, 80, 0, 0, 81, 0, 0, 82, 83, 84, 0, 85, 86, 0, 0, 87, 88, 89, 0, 0, 90, 0, 0, 0, 91, 92, 0, 93, 94, 0, 0, 0, 95, 96, 0, 0, 97, 0, 0, 0, 98, 99, 0, 100, 101, 0, 0, 102, 103, 104, 0, 0, 105, 0, 0, 106, 107, 108, 0, 109, 110, 0, 0, 0, 111, 112, 0, 0, 113, 0, 0, 0, 114, 115, 0, 116, 117, 0, 0, 118, 119, 120, 0, 0, 121, 0, 0, 0, 122, 123, 0, 124, 125, 0, 0, 0, 126, 127, 0, 0, 128, 0, 0, 129, 130, 131, 0, 132, 133, 0, 0, 134, 135, 136, 0, 0, 137, 0, 0, 138, 139, 140, 0, 141, 142, 0, 0, 0, 143, 144, 0, 0, 145, 0, 0, 146, 147, 148, 0, 149, 150, 0, 0, 151, 152, 153, 0, 0, 154, 0, 0, 0, 155, 156, 0, 157, 158, 0, 0, 0, 159, 160, 0, 0, 161, 0, 0, 162, 163, 164, 0, 165, 166, 0, 0, 167, 168, 169, 0, 0, 170, 0, 0, 171, 172, 173, 0, 174, 175, 0, 0, 0, 176, 177, 0, 0, 178, 0, 0, 0, 179, 180, 0, 181, 182, 0, 0, 183, 184, 185, 0, 0, 186, 0, 0, 0, 187, 188, 0, 189, 190, 0, 0, 0, 191, 192, 0, 0, 193, 0, 0, 0, 194, 195, 0, 196, 197, 0, 0, 198, 199, 200, 0, 0, 201, 0, 0, 202, 203, 204, 0, 205, 206, 0, 0, 0, 207, 208, 0, 0, 209, 0, 0, 210, 211, 212, 0, 213, 214, 0, 0, 215, 216, 217, 0, 0, 218, 0, 0, 0, 219, 220, 0, 221, 222, 0, 0, 0, 223, 224, 0, 0, 225, 0, 0, 0, 226, 227, 0, 228, 229, 0, 0, 230, 231, 232, 0, 0, 233, 0, 0, 234, 235, 236, 0, 237, 238, 0, 0, 0, 239, 240, 0, 0, 241, 0, 0, 0, 242, 243, 0, 244, 245, 0, 0, 246, 247, 248, 0, 0, 249, 0, 0, 0, 250, 251, 0, 252, 253, 0, 0, 0, 254, 255, 0, 0, 256, 0, 0, 257, 258, 259, 0, 260, 261, 0, 0, 262, 263, 264, 0, 0, 265, 0, 0, 266, 267, 268, 0, 269, 270, 0, 0, 0, 271, 272, 0, 0, 273, 0, 0, 274, 275, 276, 0, 277, 278, 0, 0, 279, 280, 281, 0, 0, 282, 0, 0, 0, 283, 284, 0, 285, 286, 0, 0, 0, 287, 288, 0, 0, 289, 0, 0, 290, 291, 292, 0, 293, 294, 0, 0, 295, 296, 297, 0, 0, 298, 0, 0, 299, 300, 301, 0, 302, 303, 0, 0, 0, 304, 305, 0, 0, 306, 0, 0, 0, 307, 308, 0, 309, 310, 0, 0, 311, 312, 313, 0, 0, 314, 0, 0, 0, 315, 316, 0, 317, 318, 0, 0, 0, 319, 320, 0, 0, 321, 0, 0, 322, 323, 324, 0, 325, 326, 0, 0, 327, 328, 329, 0, 0, 330, 0, 0, 331, 332, 333, 0, 334, 335, 0, 0, 0, 336, 337, 0, 0, 338, 0, 0, 339, 340, 341, 0, 342, 343, 0, 0, 344, 345, 346, 0, 0, 347, 0, 0, 0, 348, 349, 0, 350, 351, 0, 0, 0, 352, 353, 0, 0, 354, 0, 0, 0, 355, 356, 0, 357, 358, 0, 0, 359, 360, 361, 0, 0, 362, 0, 0, 363, 364, 365, 0, 366, 367, 0, 0, 0, 368, 369, 0, 0, 370, 0, 0, 0, 371, 372, 0, 373, 374, 0, 0, 375, 376, 377, 0, 0, 378, 0, 0, 0, 379, 380, 0, 381, 382, 0, 0, 0, 383, 384, 0, 0, 385, 0, 0, 0, 386, 387, 0, 388, 389, 0, 0, 390, 391, 392, 0, 0, 393, 0, 0, 394, 395, 396, 0, 397, 398, 0, 0, 0, 399, 400, 0, 0, 401, 0, 0, 402, 403, 404, 0, 405, 406, 0, 0, 407, 408, 409, 0, 0, 410, 0, 0, 0, 411, 412, 0, 413, 414, 0, 0, 0, 415, 416, 0, 0, 417, 0, 0, 418, 419, 420, 0, 421, 422, 0, 0, 423, 424, 425, 0, 0, 426, 0, 0, 427, 428, 429, 0, 430, 431, 0, 0, 0, 432, 433, 0, 0, 434, 0, 0, 0, 435, 436, 0, 437, 438, 0, 0, 439, 440, 441, 0, 0, 442, 0, 0, 0, 443, 444, 0, 445, 446, 0, 0, 0, 447, 448, 0, 0, 449, 0, 0, 0, 450, 451, 0, 452, 453, 0, 0, 454, 455, 456, 0, 0, 457, 0, 0, 458, 459, 460, 0, 461, 462, 0, 0, 0, 463, 464, 0, 0, 465, 0, 0, 466, 467, 468, 0, 469, 470, 0, 0, 471, 472, 473, 0, 0, 474, 0, 0, 0, 475, 476, 0, 477, 478, 0, 0, 0, 479, 480, 0, 0, 481, 0, 0, 0, 482, 483, 0, 484, 485, 0, 0, 486, 487, 488, 0, 0, 489, 0, 0, 490, 491, 492, 0, 493, 494, 0, 0, 0, 495, 496, 0, 0, 497, 0, 0, 0, 498, 499, 0, 500, 501, 0, 0, 502, 503, 504, 0, 0, 505, 0, 0, 0, 506, 507, 0, 508, 509, 0, 0, 0, 510, 511, 0, 0, 512, 0, 0};

short inv49[49] = {0, 1, 2, 3, 4, 5, 6, 0, 7, 8, 9, 10, 11, 12, 0, 13, 14, 15, 16, 17, 18, 0, 19, 20, 21, 22, 23, 24, 0, 25, 26, 27, 28, 29, 30, 0, 31, 32, 33, 34, 35, 36, 0, 37, 38, 39, 40, 41, 42};


int dist[1772 * 513 * 43 * 7];
//int x[12000];
//int y[12000];

complex<int> p[12000];

int main() {
    int n;
    scanf("%d", &n);
 
    int x, y;
    for (int i = 0; i < n; ++i) {
        //scanf("%d %d", x+i, y+i);
        scanf("%d %d", &x, &y);
        p[i] = {x, y};
    }
    //sort(p, p+12000);
    
//     map<int, int> dist;
    int d = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < i; ++j) {
            //int dx = x[i] - x[j];
            //int dy = y[i] - y[j];
            //int dx = p[i].first - p[j].first;
            //int dy = p[i].second - p[j].second;
            d = norm(p[i] - p[j]); //dx*dx + dy*dy;
           // s +=  inv[d & 1023];
            // cout << d << endl;
            ++dist[(d/allmod) * 513*43*7 + inv1024[(d%1024)]*43*7 + inv49[(d%49)]*7 + inv9[(d%9)]];
        }
    }
    // cout << s << endl;
    
    ull result = 0;
    
    // sort(dist, dist+a*b);
    for (int i = 0; i < 1772 * 513 * 43 * 7; ++i) {
        ull d = dist[i];
        if (d > 1) {
            result += d * (d - 1) / 2;
        }
    }
    
    printf("%lld", result);
    
    return 0;
}