#include <algorithm> #include <set> #include <cstdio> #include <cstdint> #include <vector> using namespace std; vector<unsigned long long int> positions(2000); int main() { unsigned long long int i, n, k, t; for (i = 0; i < 2000; ++i) positions[i] = ((i + 1) * (i + 2)) / 2; scanf("%llu %llu", &n, &k); long long int rts = -1; while (true && rts < 2000) if(positions[++rts] >= k) break; // else printf("%llu %llu\n", positions[rts], k); // printf("%lld\n", positions[rts]); unsigned long long int counter = 0; unsigned long long int min = 9999999999; while(counter++ < positions[rts]) { scanf("%llu", &t); if (min > t) { // printf("%llu %llu\n", min, t); min = t; } } printf("%llu\n", min); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include <algorithm> #include <set> #include <cstdio> #include <cstdint> #include <vector> using namespace std; vector<unsigned long long int> positions(2000); int main() { unsigned long long int i, n, k, t; for (i = 0; i < 2000; ++i) positions[i] = ((i + 1) * (i + 2)) / 2; scanf("%llu %llu", &n, &k); long long int rts = -1; while (true && rts < 2000) if(positions[++rts] >= k) break; // else printf("%llu %llu\n", positions[rts], k); // printf("%lld\n", positions[rts]); unsigned long long int counter = 0; unsigned long long int min = 9999999999; while(counter++ < positions[rts]) { scanf("%llu", &t); if (min > t) { // printf("%llu %llu\n", min, t); min = t; } } printf("%llu\n", min); return 0; } |