Submission #1273255

#TimeUsernameProblemLanguageResultExecution timeMemory
1273255SmuggingSpunKaučuk (COCI21_kaucuk)C++20
50 / 50
1 ms576 KiB
#include<bits/stdc++.h>
#define taskname "A"
using namespace std;
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	if(fopen(taskname".inp", "r")){
		freopen(taskname".inp", "r", stdin);
	}
	int n;
	cin >> n;
	for(int _ = 0, a = 0, b = 0, c = 0; _ < n; _++){
		string x, y;
		cin >> x >> y;
		if(x == "section"){
			a++;
			b = c = 0;
			cout << a << " " << y << "\n";
		}
		else if(x == "subsection"){
			c = 0;
			b++;
			cout << a << "." << b << " " << y << "\n";
		}
		else{
			c++;
			cout << a << "." << b << "." << c << " " << y << "\n";
		}
	}
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:7:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...