Submission #1111372

#TimeUsernameProblemLanguageResultExecution timeMemory
1111372khoaha123Teams (CEOI11_tea)C++17
0 / 100
211 ms24828 KiB
#include <bits/stdc++.h> #define endl '\n' #define ii pair<int,int> #define task "" #define all(x) x.begin(),x.end() using namespace std; const int N = 1e6 + 5; const int mod = 1e9 + 7; const int INF = 1e9; const double EPS = 1e-9; const int dx[2] = {1,0}; const int dy[2] = {0,1}; int n,a[N]; ii b[N]; vector<vector<int>> ans; signed main() { ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0); if (fopen(task".INP","r")){ freopen(task".INP","r",stdin); freopen(task".OUT","w",stdout); } cin >> n; for (int i = 1; i <= n; ++i){ cin >> a[i]; b[i] = ii(a[i],i); } sort(b+1,b+1+n,greater<ii>()); int i = 1; int res = 1; int cnt = 1; //3 2 2 2 1 while (i <= n){ i++; if (cnt >= b[i-cnt].first){ vector<int> x; for (int j = i - cnt; j < i; ++j) x.push_back(b[j].second); ans.push_back(x); cnt = 1; } else { cnt++; } } cout << ans.size() << endl; for (auto f : ans){ cout << f.size() << ' '; for (auto g : f) cout << g << ' '; cout << endl; } return 0; }

Compilation message (stderr)

tea.cpp: In function 'int main()':
tea.cpp:33:9: warning: unused variable 'res' [-Wunused-variable]
   33 |     int res = 1;
      |         ^~~
tea.cpp:22:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         freopen(task".INP","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
tea.cpp:23:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         freopen(task".OUT","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...