Submission #985108

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9851082024-05-17 10:46:25ShauryaTheShepPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
// Function to count the number of increasing subsequences
int countIncreasingSubsequences(vector<int>& permutation) {
int n = permutation.size();
vector<int> dp(n, 1); // dp[i] will store the number of increasing subsequences ending at index i
int totalCount = 0;
// Calculate the number of increasing subsequences ending at each index
for (int i = 0; i < n; ++i) {
for (int j = 0; j < i; ++j) {
if (permutation[j] < permutation[i]) {
dp[i] += dp[j];
}
}
totalCount += dp[i];
}
return totalCount;
}
// Function to construct a permutation with exactly k increasing subsequences
vector<int> construct_permutation(int64_t k) {
int n = 2;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

/usr/bin/ld: /tmp/ccT88rQy.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccUPXpty.o:perm.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccT88rQy.o: in function `main':
grader.cpp:(.text.startup+0x240): undefined reference to `construct_permutation(long long)'
collect2: error: ld returned 1 exit status