結果
| 問題 |
No.547 未知の言語
|
| コンテスト | |
| ユーザー |
かに
|
| 提出日時 | 2017-12-17 00:35:40 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 654 bytes |
| コンパイル時間 | 2,203 ms |
| コンパイル使用メモリ | 197,992 KB |
| 最終ジャッジ日時 | 2025-01-05 05:50:23 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 33 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:29:26: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type’ {aka ‘std::__cxx11::basic_string<char>’} [-Wformat=]
29 | printf("%d\n%s\n%s\n",i+1,v[i],v[i+n]);
| ~^
| |
| char*
main.cpp:29:30: warning: format ‘%s’ expects argument of type ‘char*’, but argument 4 has type ‘__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type’ {aka ‘std::__cxx11::basic_string<char>’} [-Wformat=]
29 | printf("%d\n%s\n%s\n",i+1,v[i],v[i+n]);
| ~^
| |
| char*
main.cpp:22:12: warning: ‘n’ is used uninitialized [-Wuninitialized]
22 | rep(i,2*n){
| ~^~
main.cpp:3:36: note: in definition of macro ‘rep’
3 | #define rep(a,b) for(int a = 0;a < b;a++)
| ^
main.cpp:20:9: note: ‘n’ was declared here
20 | int n;
| ^
ソースコード
#include "bits/stdc++.h"
#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0, 0, 1, -1 };
ll MOD = 1000000007;
unsigned long long str_to_int(std::string str) {
unsigned long long ret;
std::stringstream ss; ss << str;
ss >> ret;
return ret;
}
int main() {
int n;
vector<string> v;
rep(i,2*n){
string tmp;
cin >> tmp;
v.push_back(tmp);
}
rep(i,n){
if(v[i] != v[i+n]){
printf("%d\n%s\n%s\n",i+1,v[i],v[i+n]);
}
}
}
かに