Submission #1251004

#TimeUsernameProblemLanguageResultExecution timeMemory
1251004somefolkTriple Peaks (IOI25_triples)C++20
Compilation error
0 ms0 KiB
#include <iostream> #include <cmath> #include <algorithm> #include <string> #include <vector> #include <map> #include <unordered_map> #include <queue> #include <set> #include <unordered_set> #include <complex> #include <list> #include <cassert> #include <chrono> #include <random> #include <stack> #include <iomanip> #include <fstream> using namespace std; #define endl "\n" #define ll long long const int INF = 1e9+7; const int MOD = 1e9+7; vector<int> construct_range(int m, int k){ return {}; } bool check(int d1, int d2, int d3, int h1, int h2, int h3){ return (((d1 == h1 && d2 == h2 && d3 == h3) || (d1 == h1 && d2 == h3 && d3 == h2) || (d1 == h2 && d2 == h1 && d3 == h3) || (d1 == h2 && d2 == h3 && d3 == h1) || (d1 == h3 && d2 == h1 && d3 == h2) || (d1 == h3 && d2 == h2 && d3 == h1))); } ll count_triples(vector<int> a){ int n = (int)a.size(); ll cnt = 0; if(n <= 100){ for(int i = 0; i < n; i++){ for(int j = i; j < n; j++){ for(int k = j; k < n; k++){ cnt += check(j-i, k-j, k-i, a[i], a[j], a[k]); // if(check(j-i, k-j, k-i, a[i], a[j], a[k])) cout << a[i] << " " << a[j] << " " << a[k] << endl; } } } return cnt; } auto backfor = [&](int i){ int first = a[i]; if(i-first<0) return; int second = a[i-first]; if(i+second>=n) return; int third = a[i+second]; if(third == first+second){ cnt++; // cout << first << " " << second << " " << third << endl; } }; // auto backward = [&](int i){ // int first = a[i]; // if(i-first<0) return; // int second = a[i-first]; // if(i-first-second<0) return; // int third = a[i-first-second]; // if(first == third+second){ // cnt++; // // cout << first << " " << second << " " << third << endl; // } // }; for(int i = 0; i < n; i++){ backfor(i); } return cnt; } int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } cout << count_triples(a); return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cckQlI7i.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cckhMciB.o:triples.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status