SMPAIR - Editorial

Can we do this question with priority queues as well? I am a beginner, could u pls point out what’s wrong in my code?
#include
#include
using namespace std;

int main() {
int t;
cin >> t;
int temp = t;
priority_queue<int, vector, greater>p;
int n;
while(t–)
{
cin >> n;
}

int arr[n];
for(int i = 0;i < n;i++)
{
    cin >> arr[i];
}

for(int i = 0;i < n;i++)
{
    p.push(arr[i]);
}

int x = p.top();
p.pop();
int y = p.top();

while(temp--)
    cout << x+y << endl;

// your code goes here
return 0;

}