Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
148851 张法森 寻找第二小的数 C++ Compile Error 0 MS 0 KB 559 2026-03-01 19:27:34

Tests(0/0):


Code:

#include <iostream> #include <set> #include <vector> using namespace std; int main() { int C; cin >> C; for (int i = 0; i < C; i++){ int n; cin >> n; set<int> uniqueNumbers; for (int j = 0; j < n; j++) { int num; cin >> num; uniqueNumbers.insert(num); } if (uniqueNumbers.size() < 2) { cout << "NO" << endl; } else{ auto it = uniqueNumbers.begin(); ++it; return 0; }


Run Info:

Main.cc:3:19: warning: extra tokens at end of #include directive
 #include  using namespace std;
                   ^
Main.cc: In function 'int main()':
Main.cc:6:5: error: 'cin' was not declared in this scope
     cin >> C;
     ^
Main.cc:6:5: note: suggested alternative:
In file included from Main.cc:1:0:
/usr/include/c++/5/iostream:60:18: note:   'std::cin'
   extern istream cin;  /// Linked to standard input
                  ^
Main.cc:8:26: error: 'set' was not declared in this scope
         int n; cin >> n; set uniqueNumbers;
                          ^
Main.cc:8:26: note: suggested alternative:
In file included from /usr/include/c++/5/set:61:0,
                 from Main.cc:2:
/usr/include/c++/5/bits/stl_set.h:90:11: note:   'std::set'
     class set
           ^
Main.cc:8:30: error: expected primary-expression before 'int'
         int n; cin >> n; set uniqueNumbers;
                              ^
Main.cc:11:13: error: 'uniqueNumbers' was not declared in this scope
             uniqueNumbers.insert(num); 
             ^
Main.cc:12:15: error: 'uniqueNumbers' was not declared in this scope
         } if (uniqueNumbers.size() < 2) 
               ^
Main.cc:13:11: error: 'cout' was not declared in this scope
         { cout << "NO" << endl; } 
           ^
Main.cc:13:11: note: suggested alternative:
In file included from Main.cc:1:0:
/usr/include/c++/5/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^
Main.cc:13:27: error: 'endl' was not declared in this scope
         { cout << "NO" << endl; } 
                           ^
Main.cc:13:27: note: suggested alternative:
In file included from /usr/include/c++/5/iostream:39:0,
                 from Main.cc:1:
/usr/include/c++/5/ostream:590:5: note:   'std::endl'
     endl(basic_ostream<_CharT, _Traits>& __os)
     ^
Main.cc:17:13: error: expected '}' at end of input
             }
             ^
Main.cc:17:13: error: expected '}' at end of input