This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define sp " "
#define endl "\n";
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define pb push_back
#define pii pair<int, int>
#define st first
#define nd second
#define N 200005
const int modulo = 1e9 + 7;
int arr[N];
/*
void f(int ind, vector<array<int, 3>> v)
{
if (ind == 15) return;
set<array<int, 3>> s;
for (auto i : v)
{
cout<<"(";
for (int j = 0; j < 3; j++)
{
cout<<i[j]<<sp;
array<int, 3> tmp = i;
for (int k = 0; k < 3; k++) tmp[k]++;
tmp[j] -= 2;
if (tmp[j] < 0) continue;
sort(tmp.begin(), tmp.end());
s.insert(tmp);
}
cout<<") ";
}
cout<<endl;
vector<array<int, 3>> vec(s.begin(),s.end());
f(ind + 1, vec);
}*/
int32_t main()
{
fastio();
int n;
cin>>n;
vector<int> cnt(5, 0);
for (int i = 1; i <= n; i++)
{
char tmp;
cin>>tmp;
arr[i] = tmp - '0';
cnt[arr[i]]++;
}
int odd = 0;
for (int i = 1; i <= 3; i++) odd += cnt[i] % 2;
if (odd == 3 || odd == 0)
{
cout<<"DA\n";
for (int i = 1; i < n - 1; i++)
{
cout<<i<<sp<<i + 2<<sp<<1<<endl;
}
if (n > 3) cout<<n - 1<<sp<<1<<sp<<1<<endl;
}
else cout<<"NE\n";
cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " seconds\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |