Submission #899546

# Submission time Handle Problem Language Result Execution time Memory
899546 2024-01-06T12:21:14 Z duckindog Kaučuk (COCI21_kaucuk) C++14
50 / 50
1 ms 460 KB
// from duckindog wth depression
#include<bits/stdc++.h>

using namespace std;

int32_t main() {
  cin.tie(0)->sync_with_stdio(0);

  if (fopen("duck.inp", "r")) {
    freopen("duck.inp", "r", stdin);
    freopen("duck.out", "w", stdout);
  }
  int n; cin >> n;
  int one = 0, two, three;
  while (n--) {
    string s, t; cin >> s >> t;
    if (s == "section") {
      one += 1;
      two = 0, three = 0;
      cout << one << ' ' << t << '\n';
    }
    if (s == "subsection") {
      two += 1;
      three = 0;
      cout << one << "." << two << " " << t << '\n';
    }
    if (s == "subsubsection") {
      three += 1;
      cout << one << "." << two << "." << three << ' ' << t << '\n';
    }
  }
}

Compilation message

Main.cpp: In function 'int32_t main()':
Main.cpp:10:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     freopen("duck.inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:11:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     freopen("duck.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:28:13: warning: 'three' may be used uninitialized in this function [-Wmaybe-uninitialized]
   28 |       three += 1;
      |       ~~~~~~^~~~
Main.cpp:23:11: warning: 'two' may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |       two += 1;
      |       ~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 460 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 460 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct