Compile Error
foo.cc: In function 'int main()': foo.cc:8:12: error: 'T' was not declared in this scope 8 | while (T--){ | ^
Code
#include <iostream>
#include <vector>
using namespace std;
int main(){
int x;
cin >> x;
while (T--){
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; ++i)
arr[i] = i + 1;
for (int i = 0; i + 1 < n; i += 2) {
swap(arr[i], arr[i + 1]);
}
if (n% 2 == 1) {
swap(arr[n - 2], arr[n- 1]);
}
for (int i=0; i<n;++i) {
cout << arr[i] << " ";
}
cout << endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1210 A. Smallest Permutation
- Contest
- Educational Round 1
- Language
- C++11 (G++ 13.2.0)
- Submit At
- 2025-07-14 16:17:24
- Judged At
- 2025-07-14 16:17:24
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes