Submission #72399478


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
	int n;
	cin >> n;
	int mina = 2e9,minb = 2e9,minc = 2e9,a,b,c;
	for(int i = 1;i <= n;i++)
	{
		int t;
		cin >> t;
		if(t < mina) 
		{
			minc = minb;
			c = b;
			minb = mina;
			b = a;
			mina = t;
			a = i;
		}
		else if(t < minb)
		{
			minc = minb;
			c = b;
			minb = t;
			b = i;
		}
		else if(t < minc)
		{
			minc = t;
			c = i;
		}
	}
	cout << a << " " << b << " " << c;
	return 0;
}

Submission Info

Submission Time
Task B - Trifecta
User rgr2025
Language C++23 (GCC 15.2.0)
Score 200
Code Size 515 Byte
Status AC
Exec Time 1 ms
Memory 3560 KiB

Compile Error

In member function 'operator<<',
    inlined from 'main' at ./Main.cpp:36:10:
/opt/atcoder/gcc/include/c++/15.2.0/bits/ostream.h:212:25: warning: 'a' may be used uninitialized [-Wmaybe-uninitialized]
  212 |       { return _M_insert(__n); }
      |                         ^
./Main.cpp: In function 'main':
./Main.cpp:9:46: note: 'a' was declared here
    9 |         int mina = 2e9,minb = 2e9,minc = 2e9,a,b,c;
      |                                              ^
In member function 'operator<<',
    inlined from 'main' at ./Main.cpp:36:22:
/opt/atcoder/gcc/include/c++/15.2.0/bits/ostream.h:212:25: warning: 'b' may be used uninitialized [-Wmaybe-uninitialized]
  212 |       { return _M_insert(__n); }
      |                         ^
./Main.cpp: In function 'main':
./Main.cpp:9:48: note: 'b' was declared here
    9 |         int mina = 2e9,minb = 2e9,minc = 2e9,a,b,c;
      |                                                ^
In member function 'operator<<',
    inlined from 'main' at ./Main.cpp:36:34:
/opt/atcoder/gcc/include/c++/15.2.0/bits/ostream.h:212:25: warning: 'c' may be used uninitialized [-Wmaybe-uninitialized]
  212 |       { return _M_insert(__n); }
      |                         ^
./Main.cpp: In function 'main':
./Main.cpp:9:50: note: 'c' was declared here
    9 |         int mina = 2e9,minb = 2e9,minc = 2e9,a,b,c;
      |                                                  ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 10
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
random_01.txt AC 1 ms 3552 KiB
random_02.txt AC 1 ms 3376 KiB
random_03.txt AC 1 ms 3464 KiB
random_04.txt AC 1 ms 3560 KiB
random_05.txt AC 1 ms 3464 KiB
random_06.txt AC 1 ms 3440 KiB
random_07.txt AC 1 ms 3552 KiB
random_08.txt AC 1 ms 3548 KiB
sample_01.txt AC 1 ms 3376 KiB
sample_02.txt AC 1 ms 3560 KiB